import { EventTarget as be, Assets as wt, Link as v, Node as k, EventBase as ke, RectPosition as I, EllipseNode as kt, Cursor as S, AnchorProxy as Tt, AnchorUsageType as st, FunctionName as P, Point as rt, NDCAnchor as Te, NEHelper as R, NE as Le, Rectangle as me, Layer as Lt, ResourceSystem as ue, StageMode as Ee, NodeHelper as xe, Shape as Pe, RegSystem as pe } from "@jtopo/core";
import { PopupMenu as He, InputTextfield as Ae, Tooltip as Me } from "@jtopo/extensions";
function Et() {
  const s = ["2186684SvhAQI", "clientX", "1998KpbaIm", "style", "cloneNode", "210441JQzwfk", "228CYujVI", "show", "add", "1106886IHEKyN", "24952ayKTrR", "dargItem", "touchmove", "editor", "shape not exist: ", "1282xATwIv", "parentNode", "white", "449170jSOzYx", "display", "panelDom", "5CfREuX", "appendChild", "addEventListener", "11893PlMCEy", "ondragstart", "none", "removeEventListener", "height", "729tbOvfA", "shape", "itemSize", "stage", "removeChild", "touchstart", "setConfig", "281JcbZFQ"];
  return (Et = function() {
    return s;
  })();
}
function it(s, t) {
  const e = Et();
  return (it = function(n, r) {
    return e[n -= 178];
  })(s, t);
}
const at = it;
(function() {
  const s = it, t = Et();
  for (; ; )
    try {
      if (parseInt(s(212)) / 1 * (parseInt(s(191)) / 2) + parseInt(s(185)) / 3 + -parseInt(s(213)) / 4 * (-parseInt(s(197)) / 5) + parseInt(s(178)) / 6 * (-parseInt(s(200)) / 7) + parseInt(s(186)) / 8 * (parseInt(s(205)) / 9) + -parseInt(s(194)) / 10 + -parseInt(s(181)) / 11 * (parseInt(s(182)) / 12) === 374220)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class rn extends be {
  constructor(t, e) {
    const n = it;
    super(), this.itemSize = 40, this[n(208)] = t, this[n(189)] = e, this[n(196)];
    let r = document.createElement("div");
    return r[n(179)][n(195)] = n(202), r.classList.add("jtopo_iconsPanel"), this.stage.uiContainer.appendChild(r), this.panelDom = r, this;
  }
  [at(211)](t) {
    let e = this, n = this.panelDom;
    return t.items.forEach(function(r) {
      const i = it;
      let o = document.createElement("div");
      if (o.classList[i(184)]("item"), o.setAttribute("draggable", !0), o[i(201)] = function(a) {
        e[i(187)] = r;
      }, n[i(198)](o), r.shape != null) {
        let a = document.createElement("canvas");
        a.width = e.itemSize, a[i(204)] = e.itemSize;
        let l = wt.getShape(r.shape);
        if (l == null)
          throw Error(i(190) + r[i(206)]);
        wt.drawToCanvas(l, a, { size: 0.8 * e[i(207)], strokeStyle: "black", fillStyle: i(193), padding: 2 }), o[i(198)](a);
      } else
        o.innerHTML = r.iconHtml;
      o.addEventListener(i(210), function(a) {
        const l = i;
        a.preventDefault(), e[l(187)] = r, e.touchStartHandle(o, a);
      });
    }), this;
  }
  touchStartHandle(t, e) {
    const n = at;
    let r = t[n(180)](!0);
    t[n(192)][n(198)](r);
    let i = e.touches[0], o = i.clientX, a = i.clientY;
    const l = t.offsetLeft, c = t.offsetTop;
    r[n(179)].position = "absolute", r.style.zIndex = "1000";
    const h = function(p) {
      const u = n;
      let m = p.touches[0], x = m[u(214)] - o, b = m.clientY - a;
      r.style.left = l + x + "px", r.style.top = c + b + "px";
    }, d = this, g = function(p) {
      const u = n;
      t[u(203)](u(188), h), t[u(203)]("touchend", g), r.parentNode[u(209)](r), d.editor.mockDrop(p);
    };
    h(e), t[n(199)]("touchmove", h), t.addEventListener("touchend", g);
  }
  getDragItem() {
    return this.dargItem;
  }
  hide() {
    const t = at;
    return this.panelDom.style[t(195)] = "none", this;
  }
  [at(183)]() {
    return this.panelDom.style.display = "block", this;
  }
}
function ht(s, t) {
  const e = Pt();
  return (ht = function(n, r) {
    return e[n -= 168];
  })(s, t);
}
const O = ht;
function Pt() {
  const s = ["52199BXxRIK", "stage", "__controllers", "fillStyle", "2,2", "setCurrentObject", "butt", "object", "285072FwYlVq", "editor", "domElement", "style", "target", "整体透明度", "update", "bottom", "66px", "globalAlpha", "318JFcKnv", "10,1", "是否可拖拽", "currentTheme", "8305310bqTTHP", "-15px", "水平对齐", "setStyle", "fontFamily", "find", "163368UMMIVR", "basic", "64px", "52px", "keys", "name", "__folders", "lineDash", "property", "10px", "init", "48px", "round", "textBaseline", "68px", "节点属性", "scaleX", "className", "44px", "背景颜色", "bold italic", "getCtroller", "open", "hide", "117pyWbxe", "62px", "setFolderValues", "4KZJSTA", "add", "gui", "styleSystem", "948980JVEgtn", "图层属性", "56px", "backgroundColor", "斜切X", "color", "strokeStyle", "7,3", "textPosition", "getValue", "字体名称", "50px", "center", "getFolder", "fontWeight", "borderWidth", "317599VdVdGf", "3,3", "线条粗细", "black", "onFinishChange", "onChange", "showProperty", "1294626mFQoQP", "dat", "isNode", "normal", "attachTo", "forEach", "newFolder", "连线属性", "skewX"];
  return (Pt = function() {
    return s;
  })();
}
(function() {
  const s = ht, t = Pt();
  for (; ; )
    try {
      if (parseInt(s(188)) / 1 + -parseInt(s(212)) / 2 + -parseInt(s(195)) / 3 * (parseInt(s(168)) / 4) + -parseInt(s(172)) / 5 + -parseInt(s(222)) / 6 * (parseInt(s(204)) / 7) + parseInt(s(232)) / 8 * (parseInt(s(256)) / 9) + parseInt(s(226)) / 10 === 254508)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class on {
  constructor(t, e) {
    const n = ht;
    this.editor = t, this[n(196)] = e, this.gui = new e.GUI(), this.object, this.folders = {};
  }
  [O(209)](t) {
    const e = O, n = this[e(213)], r = this.editor[e(205)];
    r.inputSystem[e(216)] = t, r.selectedGroup.removeAll()[e(169)](t), t instanceof v ? n.linkCtrlBox.attachTo(t) : t instanceof k && n.nodeResizeBox[e(199)](t), n.update(), this[e(194)](t);
  }
  showProperty(t) {
    const e = O;
    if (t == null)
      return;
    this.basic = { id: t.id || "", className: t.className || "", name: t.name || "", type: t.type || "", x: 1, y: 1, imageSrc: "", width: 1, height: 1, text: "", rotation: 0, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0, originPosition: "center", draggable: t.draggable };
    const n = this.editor[e(205)][e(171)][e(225)].getStyle(t.className) || {};
    this.style = { lineDash: null, backgroundColor: n[e(175)] || "", strokeStyle: n[e(178)] || e(191), fillStyle: n[e(207)] || "black", color: n[e(177)] || "black", borderWidth: n[e(187)] || 0, fontSize: n.fontSize || 12, fontFamily: n[e(230)] || "楷体", lineWidth: n.lineWidth || 0, lineCap: e(210), globalAlpha: 1, fontWeight: n[e(186)] || e(198), textPosition: n[e(180)] || "cb", textBaseline: n[e(245)] || "top", textAlign: n.textAlign || e(184) };
    const r = this[e(233)], i = this[e(215)];
    Object.keys(r)[e(200)](function(a) {
      if (t[a] != null) {
        let l = t[a];
        r[a] = l;
      }
    });
    let o = t.getComputedStyle();
    Object[e(236)](i)[e(200)](function(a) {
      let l = o[a];
      o[a] != null && (i[a] = l);
    }), this.object == null && (this.object = t, this[e(242)]()), this.object = t, this[e(258)](r, i), t[e(197)] && this[e(185)](e(247)) != null ? (this.getFolder("节点属性").show(), this.getFolder(e(202)).hide(), this.getFolder(e(173))[e(255)]()) : this.getFolder(e(202)) != null ? (this.getFolder("连线属性").show(), this.getFolder("节点属性").hide(), this[e(185)]("图层属性").hide()) : this.getFolder("图层属性") != null && (this.getFolder("图层属性").show(), this.getFolder(e(247)).hide(), this.getFolder("连线属性").hide());
  }
  newFolder(t) {
    const e = this.gui.addFolder(t);
    return this.folders[t] = e, e;
  }
  getFolder(t) {
    return this.folders[t];
  }
  getCtrollerValue(t, e) {
    return this[O(253)](t, e).getValue();
  }
  getCtroller(t, e) {
    const n = O;
    return this.getFolder(t).__controllers[n(231)]((r) => r.property == e);
  }
  setFolderValues(t, e) {
    const n = O;
    Object[n(236)](this[n(170)][n(238)]).forEach((r) => {
      const i = n;
      this.gui[i(238)][r][i(206)].forEach(function(o) {
        let a = o.property;
        t[a] != null ? o.setValue(t[a]) : e[a] != null && o.setValue(e[a]);
      });
    });
  }
  init() {
    const t = O, e = this, n = this[t(213)], r = n.stage, i = this.basic, o = this[t(215)];
    let a = { 实线: "", "虚线1,1": "1,1", "虚线2,2": t(208), "虚线3,3": t(189), "虚线7,3": t(179), "虚线3,7": "3,7", "虚线10,1": t(223), "虚线1,10": "1,10" }, l = { "10px": t(241), "12px": "12px", "14px": "14px", "16px": "16px", "18px": "18px", "20px": "20px", "22px": "22px", "24px": "24px", "26px": "26px", "28px": "28px", "30px": "30px", "32px": "32px", "34px": "34px", "36px": "36px", "38px": "38px", "40px": "40px", "42px": "42px", "44px": t(250), "46px": "46px", "48px": t(243), "50px": t(183), "52px": t(235), "54px": "54px", "56px": t(174), "58px": "58px", "60px": "60px", "62px": t(257), "64px": t(234), "66px": t(220), "68px": t(246) }, c = { 正常: "normal", 粗体: "bold", 斜体: "italic", 加粗斜体: t(252) }, h = { 默认: "butt", 圆形: t(244), 矩形: "square" }, d = { 左: "left", 中: t(184), 右: "right" }, g = { 上: "top", 中: "middle", 下: t(219) };
    function p() {
      const z = t;
      let U = this.property, H = this[z(181)]();
      e[z(211)][U] = H === "" ? null : H, n.update();
    }
    function u() {
      const z = t;
      let U = this[z(240)], H = this.getValue(), we = e.object;
      U == "lineDash" && typeof H == "string" && (H = H.split(",")), we[z(229)](U, H === "" ? null : H), n[z(218)]();
    }
    const m = this[t(201)]("基础属性");
    m.add(i, "id").onFinishChange(p).name("id"), m.add(i, t(249)).onFinishChange(p).name(t(249)), m.add(i, "name")[t(192)](p).name("name"), m.add(i, "type")[t(192)](p).name("type"), m.open();
    const x = this[t(201)](t(173));
    x[t(169)](o, "backgroundColor")[t(193)](u).name(t(251)), x[t(254)]();
    const b = this.newFolder("节点属性");
    b.add(i, "text").onFinishChange(p).name("文字"), b.add(i, "x").onFinishChange(p), b[t(169)](i, "y")[t(192)](p), b.add(i, "width", 1).onChange(p)[t(237)]("宽度"), b[t(169)](i, "height", 1).onChange(p).name("高度"), b.add(i, t(248), -3, 3, 0.1).onChange(p).name("缩放X"), b.add(i, "scaleY", -3, 3, 0.1)[t(193)](p).name("缩放Y"), b[t(169)](i, t(203), -1, 1, 0.1).onChange(p).name(t(176)), b.add(i, "skewY", -1, 1, 0.1).onChange(p).name("斜切Y"), b.add(o, "lineWidth", 0, 10).onChange(u)[t(237)]("线条粗细"), b.add(o, "lineDash", a).onChange(u).name("虚实"), b.add(o, t(187), 0, 10).onChange(u).name("边框粗细"), b.add(o, t(207))[t(192)](u).name("填充颜色"), b.add(o, "strokeStyle")[t(192)](u).name("线条颜色"), b[t(169)](i, "imageSrc").onFinishChange(p).name("图片路径"), b.add(o, "globalAlpha", 0, 1, 0.1).onChange(u)[t(237)]("整体透明度"), b.add(i, "originPosition", { 中心: "center", 左上: "lt", 上中: "ct", 右上: "rt", 左下: "lb", 下中: "cb", 右下: "rb" })[t(192)](p).name("原点位置"), b[t(169)](i, "draggable", !0).onChange(p)[t(237)](t(224)), b.open();
    const C = this.newFolder(t(202));
    C[t(169)](i, "text").onFinishChange(p).name("文字"), C.add(o, "lineWidth", 0, 100)[t(193)](u).name(t(190)), C[t(169)](o, "strokeStyle").onFinishChange(u)[t(237)]("线条颜色"), C[t(169)](o, t(239), a).onChange(u).name("虚实"), C.add(o, "lineCap", h)[t(193)](u).name("末端样式"), C.add(o, t(221), 0, 1, 0.1)[t(193)](u).name(t(217)), C[t(254)]();
    const j = this[t(201)]("文本");
    j[t(169)](o, t(230), ["sans-serif", "Arial", "宋体", "隶书", "楷体"]).onChange(u).name(t(182)), j.add(o, "fontSize", l).onChange(u).name("大小"), j.add(o, "fontWeight", c).onChange(u).name("粗细"), j.add(o, "textPosition", { 中心: "center", 左上: "lt", 上中: "ct", 右上: "rt", 左下: "lb", 下中: "cb", 右下: "rb" }).onChange(u).name("位置"), j.add(o, "textAlign", d).onChange(u).name(t(228)), j[t(169)](o, "textBaseline", g).onChange(u)[t(237)]("垂直对齐"), j.add(o, "color").onChange(u).name("颜色"), j.open();
    let L = this.gui.domElement;
    L.remove(), r.uiContainer.appendChild(L), L[t(215)].position = "absolute", L.style.right = t(227), L.style.top = "0px", L.style.zIndex = 1e3;
  }
  [O(254)]() {
    this.gui.open();
  }
  close() {
    this[O(170)].close();
  }
  hide() {
    const t = O;
    this[t(170)][t(214)].style.display = "none";
  }
  show() {
    this.gui.domElement.style.display = "block";
  }
}
const vt = Ht;
function Ht(s, t) {
  const e = At();
  return (Ht = function(n, r) {
    return e[n -= 453];
  })(s, t);
}
(function() {
  const s = Ht, t = At();
  for (; ; )
    try {
      if (parseInt(s(455)) / 1 + -parseInt(s(458)) / 2 * (-parseInt(s(459)) / 3) + -parseInt(s(461)) / 4 * (-parseInt(s(456)) / 5) + parseInt(s(463)) / 6 + parseInt(s(460)) / 7 + -parseInt(s(457)) / 8 * (parseInt(s(453)) / 9) + -parseInt(s(465)) / 10 === 783557)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
function At() {
  const s = ["713495GAMTcp", "8neJENX", "7778UzwjnD", "552FbNHkz", "4994745ekJWPN", "20wgLASi", "rgba(0,0,0,0)", "2311134aaEYQE", "topo_last_doc", "15747250UgRmVd", "8951949VDUwlq", "rgba(255,0,0,0.5)", "825148hcaYQu"];
  return (At = function() {
    return s;
  })();
}
const y = { data: { localLastDocName: vt(464) }, connectPoint: { size: 14, style: { strokeStyle: "gray", fillStyle: "rgba(255,255,255,0.6)", lineWidth: 1, padding: 3 }, activeStyle: { lineWidth: 1, fillStyle: "rgba(0, 255,255, 0.9)", padding: 1 }, unActiveStyle: { lineWidth: 1, fillStyle: "rgba(255,255,255,0.6)", padding: 3 }, drawStartMinDistance: 7, drawStartDelay: 50 }, connectBox: { anchorDist: 7, nodeDist: 7 }, nodeResizePoint: { width: 13, height: 13, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: "#efefef", padding: 1 } }, nodeRotatePoint: { width: 14, height: 14, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: "#efefef", padding: 1 }, rotateLineStyle: { strokeStyle: "gray", lineDash: [3, 3] }, rotateLineLength: 30 }, crossGuildLine: { styleH: { strokeStyle: vt(454), lineWidth: 1 }, styleV: { strokeStyle: "rgba(0,255,0,0.5)", lineWidth: 1 }, axisInfoStyle: { color: "gray", fontSize: 16, fillStyle: vt(462) } }, linkCtrlPoint: { size: 7, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: "rgba(0,255,255,0.9)", padding: 1 }, activeStyle: { globalAlpha: 0.2 }, unactiveStyle: { globalAlpha: 1 }, adjustStyle: { strokeStyle: "gray", fillStyle: "rgba(255,255,255,0.8)", lineWidth: 1, padding: 1 }, ctrlLinkStyle: { lineDash: [2, 2], lineWidth: 1, padding: 2 } }, dropBox: { style: { fillStyle: "rgba(0,0,0,0)", border: "3px solid orange", lineDash: [5, 3], lineWidth: 1 } }, align: { gridSize: 25, minDistance: 5, alignLineStyle: { strokeStyle: "cyan", lineDash: [5, 2], lineWidth: 1 } }, operationTip: { enable: !0 } };
function Mt(s, t) {
  const e = Bt();
  return (Mt = function(n, r) {
    return e[n -= 400];
  })(s, t);
}
const q = Mt;
(function() {
  const s = Mt, t = Bt();
  for (; ; )
    try {
      if (-parseInt(s(403)) / 1 + -parseInt(s(401)) / 2 * (parseInt(s(405)) / 3) + parseInt(s(404)) / 4 + parseInt(s(412)) / 5 * (-parseInt(s(409)) / 6) + parseInt(s(411)) / 7 + parseInt(s(400)) / 8 + -parseInt(s(407)) / 9 === 266464)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const A = navigator.userAgent[q(410)]()[q(402)]("MAC OS") != -1 ? "Meta" : "Control";
function Bt() {
  const s = ["indexOf", "127878RXwIhA", "1300668fwkmdg", "227922uKStbx", "Shift", "97767fzjamR", "ArrowDown", "36EEgZdW", "toUpperCase", "3434074eYaOyv", "420490bFatkI", "Escape", "shift", "2575728Ypqyrk", "6IbzUOv"];
  return (Bt = function() {
    return s;
  })();
}
const dt = { CtrlOrCmd: A, CreateGroup: A, DropTo_leader: q(406), Delete: ["Delete", "Meta+Backspace"], Select_all: A + "+a", Select_invert: A + "+i", Cut: A + "+x", Copy: A + "+c", Paste: A + "+v", Save: A + "+s", Open: A + "+o", Undo: A + "+z", Redo: A + "+shift+z", Copy_style: "Shift+c", paste_Style: "Shift+v", Move_up: "ArrowUp", Move_down: q(408), Move_left: "ArrowLeft", Move_right: "ArrowRight", Layout_tree: "t", Layout_grid: "g", LocalView: "/", ResizeKeepAspectRatio: q(414), DrawLine: "l", Cancel: q(413), DisableNodeAlign: "Alt" };
function ve(s, t) {
  var e = jt();
  return (ve = function(n, r) {
    return e[n -= 116];
  })(s, t);
}
function jt() {
  var s = ["1496875TFgwJy", "54542vnVEyl", "8086194tmcbJq", "68wDZuPo", "4361PIWBMV", "4564032XEKKRt", "94383WObWgz", "8040lvTfSw", "20689108iEjpga", "10aYEayG", "18VTnVpc"];
  return (jt = function() {
    return s;
  })();
}
(function() {
  for (var s = ve, t = jt(); ; )
    try {
      if (-parseInt(s(119)) / 1 * (-parseInt(s(121)) / 2) + -parseInt(s(126)) / 3 * (-parseInt(s(123)) / 4) + parseInt(s(120)) / 5 + parseInt(s(125)) / 6 + -parseInt(s(124)) / 7 * (parseInt(s(116)) / 8) + parseInt(s(122)) / 9 * (parseInt(s(118)) / 10) + -parseInt(s(117)) / 11 === 477285)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class B extends ke {
  constructor(t, e) {
    super(t, e);
  }
}
const W = zt;
function zt(s, t) {
  const e = Ot();
  return (zt = function(n, r) {
    return e[n -= 475];
  })(s, t);
}
(function() {
  const s = zt, t = Ot();
  for (; ; )
    try {
      if (parseInt(s(498)) / 1 * (-parseInt(s(485)) / 2) + -parseInt(s(487)) / 3 + -parseInt(s(476)) / 4 + parseInt(s(475)) / 5 + parseInt(s(497)) / 6 * (parseInt(s(478)) / 7) + -parseInt(s(481)) / 8 * (-parseInt(s(494)) / 9) + parseInt(s(491)) / 10 * (parseInt(s(479)) / 11) === 570259)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Be = { lt: I.rb, ct: I.cb, rt: I.lb, rm: I.lm, rb: I.lt, cb: I.ct, lb: I.rt, lm: I.rm, center: I[W(500)] };
function Ot() {
  const s = ["handleNodeResize", "translateWith", "10yWpePQ", "stage", "height", "9CWdkdP", "selectedGroup", "pointerupHandler", "896046GisXjh", "13hScvRA", "setStyles", "center", "invert", "pointermoveHandler", "resize", "width", "resizeWith", "1704770VdhSKb", "305852gZCJQt", "point", "49NpQwfo", "5597262rolOGw", "e_resize", "2367632EKTLCt", "getWorldTransform", "nodeResizeBox", "style", "151546XlHIpE", "editor", "1678098UKabyW", "nodeResizePoint"];
  return (Ot = function() {
    return s;
  })();
}
class je extends kt {
  constructor(t, e) {
    const n = W;
    super(), this.nodeResizeBox = t, this[n(486)] = t.editor, this[n(492)] = this.editor.stage, this[n(495)] = this.stage.selectedGroup, this[n(503)](y.nodeResizePoint.width, y[n(488)].height), this[n(499)](y[n(488)][n(484)]), this.name = e;
  }
  [W(502)]() {
    const t = W;
    let e, n = this.name;
    n == I.lt ? e = S.nw_resize : n == I.ct ? e = S.n_resize : n == I.rt ? e = S.ne_resize : n == I.lm ? e = S.w_resize : n == I.rm ? e = S[t(480)] : n == I.lb ? e = S.sw_resize : n == I.cb ? e = S.s_resize : n == I.rb && (e = S.se_resize), this.editor.stage.setCursor(e);
  }
  _anchorToLocalPoint(t, e) {
    return t._positionToLocalPoint(e);
  }
  dragHandler(t) {
    const e = W;
    let n = this.nodeResizeBox.editor, r = this[e(483)].currNode;
    this[e(489)](r, t, n);
  }
  handleNodeResize(t, e, n) {
    const r = W;
    let i = this.name, o = t[r(482)](), a = e.xInWorld, l = e.yInWorld, c = o.point(this._anchorToLocalPoint(t, i)), h = a - c.x, d = l - c.y, g = o[r(501)]().vec([0, 0], [h, d]);
    if (h = g[0], d = g[1], i == I.lt ? (h = -h, d = -d) : i == I.ct ? (h = 0, d = -d) : i == I.rt ? d = -d : i == I.lm ? (h = -h, d = 0) : i == I.rm ? d = 0 : i == I.lb ? h = -h : i == I.cb ? h = 0 : I.rb, n.keyboard.isKeydown(dt.ResizeKeepAspectRatio) && (d = h * (t.height / (t[r(504)] || 1))), this.adjustFixedDirection(t, [h, d], i, o), h != 0 && d != 0 && n.hasListener("resize")) {
      let p = new B("resize", { target: t, details: { dx: h, dy: d, ctrl: i } });
      n.dispatchEvent(p);
    }
  }
  adjustFixedDirection(t, e, n, r) {
    const i = W;
    let o = Be[n], a = this._anchorToLocalPoint(t, o);
    a = r[i(477)](a), t[i(505)](e[0], e[1]), t[i(504)] < 0 && (t.width = 0), t.height < 0 && (t[i(493)] = 0), t.updateMatrix();
    let l = t.getWorldTransform(), c = this._anchorToLocalPoint(t, o);
    c = l.point(c);
    let h = a.x - c.x, d = a.y - c.y;
    t[i(490)](h, d), this.nodeResizeBox.updateSize();
  }
  pointerenterHandler() {
  }
  pointeroutHandler(t) {
  }
  pointerdownHandler(t) {
    t.preventDefault();
  }
  [W(496)](t) {
    t.preventDefault();
  }
}
const Y = Nt;
function _t() {
  const s = ["setCursor", "parent", "updateSize", "10TJTeoZ", "target", "26988rhlpra", "move", "65394aFYVKq", "1844YHyrdQ", "auto", "originPosition", "getRotationWithMouse", "pointerupHandler", "18qzzSuL", "calcPointByAnchor", "stage", "36606OTtHkA", "1720404FGghTP", "12001tpEyeq", "point", "8560wxWVmw", "80493yiieec", "rotate", "1050992ojpWnZ", "679zXnXZB"];
  return (_t = function() {
    return s;
  })();
}
function Nt(s, t) {
  const e = _t();
  return (Nt = function(n, r) {
    return e[n -= 122];
  })(s, t);
}
(function() {
  const s = Nt, t = _t();
  for (; ; )
    try {
      if (-parseInt(s(126)) / 1 * (-parseInt(s(129)) / 2) + -parseInt(s(134)) / 3 + parseInt(s(146)) / 4 * (-parseInt(s(133)) / 5) + -parseInt(s(145)) / 6 * (parseInt(s(137)) / 7) + -parseInt(s(136)) / 8 + parseInt(s(130)) / 9 * (-parseInt(s(141)) / 10) + -parseInt(s(131)) / 11 * (-parseInt(s(143)) / 12) === 587317)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class ze extends kt {
  constructor(t, e) {
    super(), this.editor = t.editor, this.stage = this.editor.stage, this.selectedGroup = this.stage.selectedGroup, this.setStyles(y.nodeRotatePoint.style), this.resize(y.nodeRotatePoint.width, y.nodeRotatePoint.height), this.name = e;
  }
  [Y(124)](t, e) {
    const n = Y;
    let r = e.inputSystem, i = { x: 0, y: 0 }, o = t._shape.getConnectionAnchor(t[n(123)]);
    o != null && (i = Tt[n(127)](t, o));
    let a = t.getWorldTransform()[n(132)](i);
    return Math.atan2(r.yInWorld - a.y, r.xInWorld - a.x);
  }
  pointermoveHandler() {
    const t = Y;
    this.stage.setCursor(S[t(144)]);
  }
  pointerdownHandler(t) {
    t.preventDefault();
    let e = this.stage;
    if (this.selectedGroup.getTopObjects().length == 0)
      throw new Error("selectedGroup.length is 0!");
    let n = e.inputSystem.target;
    this.elementInitAngle = n.rotation, this.mouseInitAngle = this.getRotationWithMouse(n, e);
  }
  [Y(125)](t) {
    const e = Y;
    this.stage[e(138)](S[e(122)]), t.event.preventDefault();
  }
  dragHandler(t) {
    const e = Y;
    t.event.preventDefault();
    let n = this[e(139)], r = n.editor, i = r[e(128)], o = i.inputSystem[e(142)], a = this[e(124)](o, i) - this.mouseInitAngle;
    if (o.rotate(this.elementInitAngle + a), n[e(140)](), a != 0 && r.hasListener(e(135))) {
      let l = new B("rotate", { target: o, details: { dAngle: a } });
      r.dispatchEvent(l);
    }
  }
}
function Se(s, t) {
  const e = Dt();
  return (Se = function(n, r) {
    return e[n -= 205];
  })(s, t);
}
function Dt() {
  const s = ["3085506PxXDzQ", "3781985HoMMEA", "520cdidNf", "1221736gSKHPp", "35272LJzHFF", "2184291ENEiOb", "21BGUCul", "21501hcsjsv", "6vekOJg", "521072joirUT"];
  return (Dt = function() {
    return s;
  })();
}
(function() {
  const s = Se, t = Dt();
  for (; ; )
    try {
      if (parseInt(s(207)) / 1 * (parseInt(s(211)) / 2) + parseInt(s(208)) / 3 + parseInt(s(212)) / 4 + -parseInt(s(214)) / 5 + parseInt(s(213)) / 6 + parseInt(s(209)) / 7 * (-parseInt(s(206)) / 8) + parseInt(s(210)) / 9 * (parseInt(s(205)) / 10) === 388112)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const ut = { ZIndex: { LinkCtrlBox: 10002, NodeCtrlBox: 10001, IntersectPoint: 10003, EditorNewLink: 3 } }, D = pt;
function pt(s, t) {
  const e = Wt();
  return (pt = function(n, r) {
    return e[n -= 364];
  })(s, t);
}
function Wt() {
  const s = ["rotateLineStyle", "parent", "_anchorToLocalPoint", "4nUGkCv", "105136scZcXW", "1104954kaYWTY", "isSelected", "419041KVvkZA", "isEditable", "point", "addChild", "2958395uUfNGp", "hide", "resizePoints", "initCtrlPoints", "1525224fVAIgn", "pointerenterStageHandler", "45NfZDnV", "currNode", "push", "721263iiXIPf", "updateSize", "674083qVzhxo"];
  return (Wt = function() {
    return s;
  })();
}
(function() {
  const s = pt, t = Wt();
  for (; ; )
    try {
      if (-parseInt(s(374)) / 1 + parseInt(s(379)) / 2 + parseInt(s(372)) / 3 * (-parseInt(s(378)) / 4) + parseInt(s(386)) / 5 + -parseInt(s(380)) / 6 + -parseInt(s(382)) / 7 + -parseInt(s(367)) / 8 * (-parseInt(s(369)) / 9) === 438986)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Oe extends k {
  constructor(t, e = 0, n = 0, r = 1, i = 1) {
    super(null, e, n, r, i), this.resizePoints = [], this.zIndex = ut.ZIndex.NodeCtrlBox, this.editor = t, this.pointerEnabled = !1, this.hide(), this.initCtrlPoints();
  }
  [D(366)]() {
    const t = D;
    let e = this, n = new ze(this, "rotate");
    this.addChild(n), this.rotateNode = n;
    let r = new v();
    r.setStyles(y.nodeRotatePoint[t(375)]), r.pointerEnabled = !1, this.rotateLink = r, this[t(385)](r), this.rotateLink = r, ["lt", "lb", "rt", "rb"].forEach((i) => {
      const o = t;
      let a = new je(this, i);
      e.resizePoints[o(371)](a);
    }), this.addChildren(this.resizePoints);
  }
  _anchorToLocalPoint(t, e) {
    return t._positionToLocalPoint(e);
  }
  attachTo(t) {
    const e = D;
    if (t != null) {
      if (!function(n) {
        let r = n[pt(376)];
        return r instanceof v && (r.beginArrow === n || r.endArrow === n);
      }(t)) {
        if (!this.editor[e(383)](t))
          throw new Error("attach not Node or not editable");
        this.currNode = t, this.updateSize(), this.show();
      }
    } else
      this.clearTarget();
  }
  [D(373)]() {
    const t = D;
    let e = this.currNode;
    if (e == null || e[t(381)] == 0 || e.parent == null)
      return this.currNode = null, void this.hide();
    let n = this.editor.stage.camera, r = this.currNode;
    r.updateMatrix();
    let i = n.getObjectScreenTransform(r);
    {
      let o = this._anchorToLocalPoint(r, I.ct), a = i.point(o);
      o.y -= y.nodeRotatePoint.rotateLineLength, o = i[t(384)](o), this.rotateLink.setBegin(a), this.rotateLink.setEnd(o), this.rotateNode.translate(o.x, o.y);
    }
    for (let o = 0; o < this[t(365)].length; o++) {
      let a = this.resizePoints[o], l = this[t(377)](r, a.name);
      l = i[t(384)](l), a.translate(l.x, l.y);
    }
  }
  update() {
    const t = D;
    super.update(), this.visible && this[t(370)] != null && this[t(373)]();
  }
  clearTarget() {
    const t = D;
    this.currNode = null, this[t(364)]();
  }
  pointeroutStageHandler() {
  }
  [D(368)]() {
  }
}
function Rt() {
  const s = ["isLink", "findConnectableEndpoint", "updateMatrix", "231813jakgSa", "attachedLink", "60940YLLuYB", "setCursor", "style", "pointermoveHandler", "isDragStart", "connectBox", "equals", "editor", "LinkEnd", "stage", "linkCtrlPoint", "parent", "name", "65706jfLWVB", "9BaixVF", "3007136sOSvfP", "1497416HSmAHm", "end", "590910OZOQWI", "preventDefault", "7SWaySs", "6SUlLEL", "12aYGIbv", "xInWorld", "active", "setStyles", "isActive", "2215ampTzj", "hide", "anchor", "host"];
  return (Rt = function() {
    return s;
  })();
}
const $ = gt;
function gt(s, t) {
  const e = Rt();
  return (gt = function(n, r) {
    return e[n -= 435];
  })(s, t);
}
(function() {
  const s = gt, t = Rt();
  for (; ; )
    try {
      if (-parseInt(s(463)) / 1 + -parseInt(s(465)) / 2 * (parseInt(s(450)) / 3) + -parseInt(s(451)) / 4 * (parseInt(s(456)) / 5) + parseInt(s(442)) / 6 + -parseInt(s(449)) / 7 * (-parseInt(s(445)) / 8) + parseInt(s(443)) / 9 * (-parseInt(s(447)) / 10) + parseInt(s(444)) / 11 === 118331)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class _e extends kt {
  constructor(t, e) {
    const n = gt;
    super(), this.isConnectPoint = !0, this.isActive = !1, this.anchor = e, this.linkCtrlBox = t, this.setRadius(y[n(439)].size), this.editor = this.linkCtrlBox.editor, this.setStyles(y.linkCtrlPoint[n(467)]);
  }
  [$(453)]() {
    this.setStyles(y.linkCtrlPoint.activeStyle), this.isActive = !0;
  }
  unActive() {
    this[$(454)](y.linkCtrlPoint.unactiveStyle), this.isActive = !1;
  }
  pointermoveHandler(t) {
    const e = $;
    this.editor.connectBox.hide();
    let n = this.parent[e(464)], r = this[e(436)][e(438)], i = n[e(440)].worldToLocalXY(r.inputSystem.xInWorld, r.inputSystem.yInWorld);
    this.anchor[e(468)](n, r, i);
  }
  pointerdownHandler(t) {
    this.editor.stage.setCursor(S.auto), this.canConnectAnchorProxy = null;
  }
  dragHandler(t) {
    const e = $;
    let n = this[e(440)], r = n[e(440)].stage;
    const i = this.editor;
    let o = n[e(464)];
    i.connectBox[e(457)]();
    const a = this[e(441)], l = this.anchor;
    t[e(469)] && l.usage & st.ADJUST && this.active();
    let c = o.parent.worldToLocalXY(r.inputSystem[e(452)], r.inputSystem.yInWorld);
    if (a == P.LinkBegin || a == P.LinkEnd)
      return l.pointermoveHandler(o, r, c), void (this.canConnectAnchorProxy = i[e(470)][e(461)]([o]));
    l.pointermoveHandler(o, r, c), n.update();
  }
  pointerupHandler(t) {
    const e = $;
    this.editor.stage[e(466)](S.auto), t.event[e(448)]();
    let n = this.parent.attachedLink, r = this[e(458)][e(441)];
    if (this.canConnectAnchorProxy != null && !this.canConnectAnchorProxy[e(435)](n.begin) && !this.canConnectAnchorProxy[e(435)](n[e(446)])) {
      let i = this.canConnectAnchorProxy, o = i[e(459)];
      if (o[e(460)]) {
        let a = o;
        a.end.host !== n && a.begin[e(459)] !== n && (r == P.LinkBegin ? n.setBegin(i) : r == P[e(437)] && n.setEnd(i), n._upgradeParent(), n[e(462)]());
      } else
        r == P.LinkBegin ? n.setBegin(i) : r == P.LinkEnd && n.setEnd(i), n._upgradeParent(), n.updateMatrix();
    }
    this[e(455)] && this.unActive(), this.canConnectAnchorProxy = null;
  }
}
function Ft() {
  const s = ["1206961UsAIwr", "attachedLink", "init", "BezierLinkCtrlPoint2", "values", "pointXY", "editor", "ctrlLine", "stage", "4eDxFeR", "ctrlPointMap", "show", "10301958WfsYEw", "hide", "clear", "_createCtrlLink", "map", "linkCtrlPoint", "name", "translate", "clearTarget", "5354945EYLVXC", "4935459AZAEtb", "getAnchor", "ZIndex", "center", "anchor", "setStyles", "attachTo", "656XiTwea", "8251488rtAKWB", "1348330TmHbyl", "117544wGZIKS", "10fKahFN"];
  return (Ft = function() {
    return s;
  })();
}
const _ = ft;
function ft(s, t) {
  const e = Ft();
  return (ft = function(n, r) {
    return e[n -= 224];
  })(s, t);
}
(function() {
  const s = ft, t = Ft();
  for (; ; )
    try {
      if (-parseInt(s(226)) / 1 + parseInt(s(257)) / 2 + parseInt(s(248)) / 3 + -parseInt(s(235)) / 4 * (-parseInt(s(247)) / 5) + -parseInt(s(238)) / 6 + -parseInt(s(224)) / 7 * (-parseInt(s(255)) / 8) + parseInt(s(256)) / 9 * (-parseInt(s(225)) / 10) === 926465)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ne extends k {
  constructor(t) {
    const e = ft;
    super(), this.ctrlPointMap = /* @__PURE__ */ new Map(), this.zIndex = ut[e(250)].LinkCtrlBox, this.editor = t, this.init();
  }
  [_(254)](t) {
    const e = _;
    this.createCtrlPoints(t), this.updateCtrlPoints(), this[e(237)]();
  }
  createCtrlPoint(t) {
    let e = new _e(this, t);
    return e.name = t.name, this.addChild(e), e;
  }
  updateSize() {
    const t = _, e = this.editor[t(234)].inputSystem.target;
    this.attachedLink && this[t(227)].parent != null ? this[t(227)].parent == null || e == null || this.attachedLink != e ? (this[t(227)] = null, this.hide()) : this.attachTo(this.attachedLink) : this.hide();
  }
  createCtrlPoints(t) {
    const e = _;
    this.removeAllChildren(), this.ctrlPointMap[e(240)](), this.attachedLink = t;
    let n = Array.from(t.getShape().getAnchors().values()).filter((i) => i.usage & st.ADJUST), r = n[e(242)]((i) => i.name);
    this.anchorNameStr = r.join(",");
    for (let i = 0; i < n.length; i++) {
      let o = n[i], a = o[e(244)], l = this.createCtrlPoint(o);
      this.ctrlPointMap.set(a, l);
    }
    for (let i of this.ctrlPointMap.values()) {
      let o = i.anchor, a = o.name;
      if (o.usage != (st.CONNECT_EDIT | st.ADJUST) && (i[e(253)](y[e(243)].adjustStyle), i.isConnectPoint = !1), a == P.QuadBezierLinkCtrlPoint) {
        let l = this.ctrlPointMap.get(P.LinkBegin), c = this._createCtrlLink(i[e(249)](I[e(251)]), l.getAnchor(I[e(251)]));
        i[e(233)] = c;
      } else if (a == P.BezierLinkCtrlPoint1) {
        let l = this.ctrlPointMap.get(P.LinkBegin), c = this[e(241)](i[e(249)](I.center), l.getAnchor(I.center));
        i.ctrlLine = c;
      } else if (a == P[e(229)]) {
        let l = this[e(236)].get(P.LinkEnd), c = this._createCtrlLink(i.getAnchor(I.center), l[e(249)](I[e(251)]));
        i.ctrlLine = c;
      }
    }
  }
  _createCtrlLink(t, e) {
    const n = _;
    let r = new v(null, t, e);
    return r[n(253)](y.linkCtrlPoint.ctrlLinkStyle), this.addChild(r), r.pointerEnabled = !1, r;
  }
  updateCtrlPoints() {
    const t = _, e = this.attachedLink;
    let n = this[t(232)].stage.camera.getObjectScreenTransform(e);
    for (let r of this[t(236)][t(230)]()) {
      let i = r[t(252)], o = Tt.calcPointByAnchor(e, i), a = n[t(231)](o.x, o.y);
      r[t(245)](a.x, a.y);
    }
  }
  update() {
    super.update(), this.visible && this.attachedLink != null && this.updateCtrlPoints();
  }
  [_(246)]() {
    const t = _;
    this[t(236)].clear(), this.removeAllChildren(), this[t(239)]();
  }
  [_(228)]() {
    this.ctrlPointMap.clear(), this.hide();
  }
  pointeroutStageHandler() {
  }
  pointerenterStageHandler() {
  }
}
const M = ot;
(function() {
  const s = ot, t = Gt();
  for (; ; )
    try {
      if (-parseInt(s(385)) / 1 * (parseInt(s(402)) / 2) + -parseInt(s(379)) / 3 + parseInt(s(401)) / 4 + -parseInt(s(400)) / 5 * (parseInt(s(403)) / 6) + -parseInt(s(362)) / 7 + -parseInt(s(378)) / 8 * (parseInt(s(366)) / 9) + parseInt(s(387)) / 10 === 147919)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
var ge, De = Object.defineProperty, We = Object.getOwnPropertyDescriptor;
function ot(s, t) {
  const e = Gt();
  return (ot = function(n, r) {
    return e[n -= 362];
  })(s, t);
}
function Gt() {
  const s = ["85226cMWuRu", "3174MYQHyH", "dragHandler", "getSegmentAnchor", "begin", "973077mkQIUz", "active", "beginAnchorProxy", "equals", "182790CWGKMI", "stage", "activedPoint", "update", "connectPoint", "instanceManager", "isActive", "length", "pointermoveHandler", "auto", "target", "_shape", "48lEVXoh", "857166YgoPnG", "setStyles", "segIndex", "findConnectableEndpoint", "pointeroutHandler", "绘制新线", "1mzVnIb", "timeStamp", "7878260dHpJSj", "unactive", "xInWorld", "editor", "drawStartInfo", "link", "recordEnd", "inputSystem", "anchorProxy", "parent", "pointerenterHandler", "connectBox", "yInWorld", "1735FujpQz", "531448jCfvcn"];
  return (Gt = function() {
    return s;
  })();
}
class lt extends k {
  constructor(t, e = 0, n = 0, r = 1, i = 1, o) {
    const a = ot;
    super(null, e, n, r, i), this[a(372)] = !1, this.isIntersectPoint = !1, this[a(398)] = t, this.editor = t.editor, this[a(367)] = this.editor.stage, this.resize(y[a(370)].size, y[a(370)].size), this[a(380)](y.connectPoint.style), this.unactive(), this.anchor = o;
  }
  setIntersect(t) {
    this.intersect = t;
  }
  [M(397)]() {
    this.active();
  }
  [M(383)]() {
    this.stage.setCursor(S.auto), this.unactive();
  }
  [M(374)]() {
  }
  pointerdownHandler() {
    const t = M;
    event.preventDefault(), this.editor.stage.setCursor(S[t(375)]), this.link = null;
  }
  [M(404)](t) {
    const e = M;
    if (t.buttons == 2)
      return;
    const n = this.editor, r = n[e(367)];
    this.connectBox[e(368)] && this[e(398)].activedPoint[e(388)]();
    const i = this[e(398)][e(376)];
    if (t.isDragStart) {
      let o;
      if (this.isIntersectPoint) {
        let a = this.connectBox.intersect;
        o = i[e(405)](a.t, a[e(381)]);
      } else
        o = i.getAnchor(this.name);
      this.drawStartInfo = { x: t.x, y: t.y, beginAnchorProxy: o, timeStamp: Date.now() };
    } else {
      if (this.drawStartInfo != null) {
        let o = rt.distance(this.drawStartInfo.x, this[e(391)].y, t.x, t.y);
        if (Date.now() - this.drawStartInfo[e(386)] > y.connectPoint.drawStartDelay && o > y[e(370)].drawStartMinDistance) {
          this.editor.record(e(384));
          let a = { x: r.inputSystem.xInWorld, y: r.inputSystem.yInWorld };
          const l = n.instanceManager.lineDrawn(i, a, this.drawStartInfo[e(364)]);
          this.link = l;
          let c = l[e(396)].worldToLocalXY(r.inputSystem[e(389)], r[e(394)].yInWorld);
          l.setEnd(c), this.drawStartInfo = null;
        }
      }
      if (this[e(392)] != null && this.link.end != null) {
        let o = this[e(392)].parent.worldToLocalXY(r.inputSystem.xInWorld, r.inputSystem[e(399)]);
        this[e(392)].setEnd(o), this.anchorProxy = this.connectBox[e(382)]([this.link, this.link.end.host]);
      }
    }
  }
  pointerupHandler(t) {
    const e = M;
    this.show(), this[e(390)][e(369)](), this.editor.stage.setCursor(S.auto), this.link != null && (this.anchorProxy && (this[e(395)][e(365)](this.link[e(406)]) ? this.link.removeFromParent() : (this.link.setEnd(this.anchorProxy), this[e(392)]._upgradeParent(), this.editor[e(371)].lineDrawingFinished(this.link))), this.editor[e(393)](e(384))), this[e(392)] = null;
  }
  [M(363)]() {
    const t = M;
    this.isActive = !0, this[t(380)](y.connectPoint.activeStyle), this.scale(1.2, 1.2);
  }
  unactive() {
    this[M(372)] = !1, this.setStyles(y.connectPoint.unActiveStyle), this.scale(1, 1);
  }
}
((s, t, e, n) => {
  const r = ot;
  for (var i, o = n > 1 ? void 0 : n ? We(t, e) : t, a = s[r(373)] - 1; a >= 0; a--)
    (i = s[a]) && (o = (n ? i(t, e, o) : i(o)) || o);
  n && o && De(t, e, o);
})([(ge = wt.getShape("Ellipse"), (s, t) => {
  s[t] = ge;
})], lt.prototype, M(377), 2);
const St = Vt;
function Vt(s, t) {
  const e = Xt();
  return (Vt = function(n, r) {
    return e[n -= 434];
  })(s, t);
}
(function() {
  const s = Vt, t = Xt();
  for (; ; )
    try {
      if (-parseInt(s(443)) / 1 * (parseInt(s(439)) / 2) + parseInt(s(441)) / 3 + parseInt(s(444)) / 4 + -parseInt(s(438)) / 5 + parseInt(s(440)) / 6 + parseInt(s(445)) / 7 + -parseInt(s(446)) / 8 === 570511)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class X {
  static isUpdateMatrixed(t) {
    return t._obb != null && t._obb.points != null;
  }
  static [St(442)](t, e, n) {
    return X.isUpdateMatrixed(t) && n.indexOf(t) == -1 && e.isConnectable(t);
  }
  static aliagnAble(t, e) {
    const n = St;
    return (r) => r.isNode && r !== e && r !== r[n(437)].beginArrow && r !== r[n(437)][n(434)] && r !== r.parent.label;
  }
  static isAlignable(t) {
    const e = St;
    return !(t.keyboard[e(436)](dt.DisableNodeAlign) || t.stage[e(435)].objects.length > 1);
  }
}
function Xt() {
  const s = ["1372490XIomWu", "8sDOaAG", "6025764cBcPdd", "2346144azCRbv", "connectable", "7757mPpIGc", "3703064CehrIa", "986279BxVdyb", "15815744lYmRPW", "endArrow", "selectedGroup", "isKeydown", "parent"];
  return (Xt = function() {
    return s;
  })();
}
const E = N;
function Ut() {
  const s = ["activeNameOrPoint is null", "512790NfdgSL", "284466qszqEt", "parent", "addChild", "setTarget", "filter", "246FrEVtX", "1121688FFAaxN", "65EjmqAc", "hide", "intersect", "object", "showIntersectAnchor", "editor", "name", "getSegmentAnchor", "yInWorld", "dist", "stage", "getCenter", "getConnectableEndpointFromObjects", "125213sITQnH", "ctrlIntersectPoint", "point", "removeAllChildren", "229476IRwFxy", "segIndex", "isControlDown", "intersectPoint", "forEach", "MAX_SAFE_INTEGER", "keyboard", "activedPoint", "xInWorld", "sort", "length", "getObjectScreenTransform", "camera", "clearTarget", "usage", "pointeroutStageHandler", "8uxbSse", "distance", "translate", "target", "unactive", "createAnchorPoint", "100xcBmOH", "setStyles", "children", "isConnectable", "930781rWKDxH", "_findChildren", "13138POBixH", "calcPointByAnchor", "anchorToLocalPoint"];
  return (Ut = function() {
    return s;
  })();
}
(function() {
  const s = N, t = Ut();
  for (; ; )
    try {
      if (-parseInt(s(320)) / 1 + -parseInt(s(322)) / 2 * (-parseInt(s(332)) / 3) + -parseInt(s(294)) / 4 * (-parseInt(s(334)) / 5) + parseInt(s(326)) / 6 + parseInt(s(327)) / 7 + parseInt(s(310)) / 8 * (-parseInt(s(333)) / 9) + -parseInt(s(316)) / 10 * (-parseInt(s(347)) / 11) === 468975)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Re extends k {
  constructor(t, e = 0, n = 0, r = 1, i = 1) {
    const o = N;
    super(null, e, n, r, i), this.editor = t;
    let a = new Te(o(297), 0, -1);
    this.ctrlIntersectPoint = this.createAnchorPoint("intersectPoint", a), this.ctrlIntersectPoint.isIntersectPoint = !0, this.ctrlIntersectPoint.hide();
  }
  setTarget(t) {
    const e = N;
    if (this[e(339)][e(319)](t)) {
      if (this.target !== t) {
        if (this[e(313)] = t, t != null && (t instanceof k || t instanceof v)) {
          this[e(350)](), this.addChild(this.ctrlIntersectPoint);
          let n = fe(t);
          for (let r of n)
            this[e(315)](r.name, r);
        }
        this.adjustConnectNodes();
      }
      this[e(318)][e(298)]((n) => n.unactive()), this.ctrlIntersectPoint[e(335)](), this.show();
    }
  }
  adjustConnectNodes() {
    const t = N;
    if (this[t(313)] == null || this.target[t(328)] == null)
      return void this.clearTarget();
    const e = this[t(313)];
    let n = this.editor[t(344)].camera[t(305)](e);
    const r = this.children;
    for (let i = 0; i < r.length; i++) {
      const o = r[i];
      if (!o.isIntersectPoint) {
        if (o.name != null) {
          let a = o.anchor, l = Tt[t(323)](e, a), c = n[t(349)](l);
          o.translate(c.x, c.y);
        }
      }
    }
  }
  setTargetWithName(t, e) {
    const n = N;
    if (e == null)
      throw new Error(n(325));
    this[n(330)](t), this.activePointByName(e), this.show();
  }
  clearActived() {
    const t = N;
    this[t(301)] && this[t(301)][t(314)](), this.ctrlIntersectPoint.hide();
  }
  activePointByName(t) {
    const e = N;
    this.activedPoint && this.activedPoint[e(314)]();
    let n = this.children.filter((r) => r[e(340)] == t)[0];
    this[e(301)] = n, n.active(), this.ctrlIntersectPoint.hide();
  }
  [E(338)](t) {
    const e = E;
    if (this[e(336)] = t, t == null)
      return void this.ctrlIntersectPoint[e(335)]();
    let n = t.t, r = t.segIndex;
    const i = this.target;
    let o = i.getLocalPoint(n, r), a = this[e(339)].stage.camera[e(305)](i)[e(349)](o);
    this[e(348)][e(312)](a.x, a.y), this.ctrlIntersectPoint[e(317)](y.connectPoint.activeStyle), this.ctrlIntersectPoint.show();
  }
  [E(315)](t, e) {
    const n = E, r = new lt(this, 0, 0, 1, 1, e);
    return r.name = t, r.connectBox = this, this[n(329)](r), r;
  }
  getObjectsIntersect(t) {
    const e = E;
    let n = this[e(339)].stage, r = { x: n.inputSystem.xInWorld, y: n.inputSystem.yInWorld };
    const i = y.connectBox.nodeDist;
    let o = Number[e(299)], a = null;
    for (let l = 0; l < t[e(304)]; l++) {
      const c = t[l];
      let h = R.getNearestPoint(c, r);
      h.dist < i && h[e(343)] < o && (o = h[e(343)], h.object = c, a = h);
    }
    return a;
  }
  [E(346)](t) {
    const e = E, n = this[e(339)], r = this, i = n.stage, o = i.inputSystem, a = { x: o.x, y: o.y }, l = this.getNearestAnchorOnObjects(i.camera, a, t, y.connectPoint.size / 2), c = n[e(300)][e(296)]();
    if (l.length == 0 && !c) {
      let d = function(g, p) {
        const u = E, m = g.getCurrentLayer(), x = { x: g.inputSystem[u(302)], y: g.inputSystem[u(342)] };
        let b = m.displayList[u(331)]((L) => L.isNode), C = b.map((L, z) => {
          const U = u;
          let H = L._obb.aabb[U(345)]();
          return { index: z, dist: rt.distance(x.x, x.y, H.x, H.y) };
        });
        if (C = C.filter((L) => L[u(343)] <= p), C.length == 0)
          return null;
        C[u(303)]((L, z) => L[u(343)] - z.dist);
        let j = C[0].index;
        return b[j];
      }(i, 100);
      return this.editor.isConnectable(d) && r.setTarget(d), null;
    }
    if (l[e(304)] > 0) {
      l[e(303)]((m, x) => {
        let b = m.object, C = x.object;
        return c ? (b instanceof v ? 0 : 1) - (C instanceof v ? 0 : 1) : (b instanceof k ? 0 : 1) - (C instanceof k ? 0 : 1);
      });
      const d = l[0], g = d.object;
      let p = d.anchorName;
      const u = g.getAnchor(p);
      return r.setTargetWithName(g, p), u;
    }
    const h = this.getObjectsIntersect(t);
    if (h != null) {
      const d = h[e(337)];
      if (d instanceof k || d instanceof v) {
        r.setTarget(d);
        const g = d[e(341)](h.t, h[e(295)]);
        return this.showIntersectAnchor(h), g;
      }
      throw new Error("unknow intersect object:" + d);
    }
    return r[e(307)](), null;
  }
  findConnectableEndpoint(t) {
    const e = E, n = this.editor, r = n.stage[e(306)].localView.getObject()[e(321)](function(i) {
      return X.connectable(i, n, t);
    }, !0);
    return this[e(346)](r);
  }
  getNearestAnchorOnObjects(t, e, n, r) {
    const i = E;
    let o = [];
    for (let a = 0; a < n.length; a++) {
      const l = n[a], c = t.getObjectScreenTransform(l);
      let h = fe(l);
      for (let d of h) {
        let g = R[i(324)](l, d[i(340)]), p = c.point(g), u = rt.distance(p.x, p.y, e.x, e.y);
        if (u < r) {
          const m = { distance: u, object: l, anchorName: d[i(340)] };
          o.push(m);
        }
      }
    }
    return o[i(303)]((a, l) => a[i(311)] - l.distance), o;
  }
  update() {
    super.update(), this.adjustConnectNodes();
  }
  clearTarget() {
    const t = E;
    this[t(313)] = null, this[t(335)]();
  }
  cancel() {
  }
  [E(309)]() {
  }
  pointerenterStageHandler() {
  }
}
function fe(s) {
  const t = E;
  let e = s._shape.getConnectionAnchors(), n = [];
  for (let r of e)
    r[t(308)] & st.CONNECT_EDIT && n.push(r);
  return n;
}
function N(s, t) {
  const e = Ut();
  return (N = function(n, r) {
    return e[n -= 294];
  })(s, t);
}
function Yt() {
  const s = ["historyMaxLength", "undoHistory", "redoHistory", "length", "2724DLxGnk", "156tkUbli", "push", "连线调整", "602760sinkwk", "640704UzEaic", "142075Ogkfqm", "371179VZFKOh", "59759uxCbHP", "editor", "checkHistoryLength", "修改样式", "尺寸修改", "undo", "2421Dprnya", "undoFn", "位置改变", "347778wrTaoi", "修改属性"];
  return (Yt = function() {
    return s;
  })();
}
const T = Kt;
function Kt(s, t) {
  const e = Yt();
  return (Kt = function(n, r) {
    return e[n -= 285];
  })(s, t);
}
(function() {
  const s = Kt, t = Yt();
  for (; ; )
    try {
      if (-parseInt(s(295)) / 1 + parseInt(s(293)) / 2 + -parseInt(s(302)) / 3 * (-parseInt(s(288)) / 4) + -parseInt(s(294)) / 5 + -parseInt(s(289)) / 6 * (parseInt(s(296)) / 7) + parseInt(s(292)) / 8 + -parseInt(s(305)) / 9 === 285066)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})(), T(304), T(300), T(291), T(299), T(306);
class Fe {
  constructor(t, e, n) {
    this.type = t, this.undoFn = n, this.redoFn = e;
  }
  redo() {
    this.redoFn();
  }
  [T(301)]() {
    this[T(303)]();
  }
}
class Ge extends EventTarget {
  constructor(t) {
    const e = T;
    super(), this.historyMaxLength = 10, this[e(297)] = t, this.undoHistory = [], this.redoHistory = [];
  }
  clear() {
    const t = T;
    this.undoHistory = [], this[t(286)] = [];
  }
  [T(290)](t, e, n) {
    const r = T;
    let i = new Fe(t, e, n);
    return i[r(297)] = this.editor, this.redoHistory.length = 0, this.undoHistory.push(i), this.checkHistoryLength(), i;
  }
  [T(301)]() {
    const t = T;
    if (this.undoHistory[t(287)] == 0)
      return null;
    let e = this[t(285)].pop();
    return e.undo(), this[t(286)].push(e), this[t(298)](), e;
  }
  redo() {
    const t = T;
    if (this.redoHistory[t(287)] == 0)
      return null;
    let e = this[t(286)].pop();
    return e.redo(), this.undoHistory.push(e), this.checkHistoryLength(), e;
  }
  checkHistoryLength() {
    const t = T;
    this.undoHistory[t(287)] > this.historyMaxLength && this.undoHistory.shift(), this.redoHistory.length > this[t(307)] && this.redoHistory.shift();
  }
}
function Qt() {
  const s = ["160806uszOBW", "getAllVersions", "269226FIetHT", "10UyXHjn", "7iKgXZr", "12npCgal", "1536704ZvCEmq", "32PqjSxQ", "length", "1090719gQnHEX", "52UeqHRN", "5590167TZnoug", "339vUAzIy", "setItem", "12585Mzsuvt"];
  return (Qt = function() {
    return s;
  })();
}
function ct(s, t) {
  const e = Qt();
  return (ct = function(n, r) {
    return e[n -= 488];
  })(s, t);
}
(function() {
  const s = ct, t = Qt();
  for (; ; )
    try {
      if (-parseInt(s(495)) / 1 + parseInt(s(502)) / 2 * (-parseInt(s(492)) / 3) + -parseInt(s(490)) / 4 * (-parseInt(s(494)) / 5) + parseInt(s(497)) / 6 * (parseInt(s(499)) / 7) + -parseInt(s(501)) / 8 + -parseInt(s(489)) / 9 * (parseInt(s(498)) / 10) + -parseInt(s(491)) / 11 * (-parseInt(s(500)) / 12) === 109896)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Ve = { getItem: function(s) {
  return localStorage.getItem(s);
}, setItem: function(s, t) {
  localStorage[ct(493)](s, t);
}, saveWithVersion(s, t) {
  s += Date.now(), this.setItem(s, t);
}, getAllVersions: (s) => Object.keys(localStorage).filter((t) => t.startsWith(s)).sort(), getLastVersion(s, t) {
  const e = ct;
  let n = this[e(496)](s).reverse();
  if (n[e(488)] == 0)
    return;
  t == null && (t = 0), t + 1 >= n.length && (t = n.length - 1);
  let r = n[t];
  return this.getItem(r);
} };
function qt() {
  const s = ["isArray", "update", "3821571gcInLX", "getObject", "Select_all", "localView", "Move_up", "showOpTooltip", "styleCopyHandler", "isNode", "getTopObjects", "select", "124LLvTCj", "layoutManager", "forEach", "128727MrrKTh", "1216998MkXIvO", "Paste", "Undo", "children", "doGridLayout", "3039845xXNYKW", "copyHandler", "28IsUzkV", "redoUndoSys", "99688YIManz", "keyup", "keyConfig", "cutHandler", "imageToBase64", "Save", "5696243QnQSEK", "filter", "1128aGHvXr"];
  return (qt = function() {
    return s;
  })();
}
function Jt(s, t) {
  const e = qt();
  return (Jt = function(n, r) {
    return e[n -= 421];
  })(s, t);
}
(function() {
  const s = Jt, t = qt();
  for (; ; )
    try {
      if (parseInt(s(446)) / 1 * (-parseInt(s(433)) / 2) + -parseInt(s(449)) / 3 * (parseInt(s(423)) / 4) + parseInt(s(421)) / 5 + -parseInt(s(450)) / 6 + parseInt(s(431)) / 7 + parseInt(s(425)) / 8 + -parseInt(s(436)) / 9 === 436428)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Xe {
  constructor(t) {
    this.editor = t, this.init();
  }
  init() {
    const t = Jt, e = this.editor, n = e.stage, r = e.getCurrentLayer();
    let i = e.stage.keyboard;
    const o = e[t(427)];
    function a(l, c, h) {
      !Array[t(434)](l) && (l = [l]), l.forEach((d) => {
        i.bindKey(d, function(g) {
          c(g);
        }, h);
      });
    }
    i.addEventListener(t(426), function(l) {
      e[t(435)]();
    }), a(o.Delete, (l) => e.editorEventManager.deleteHandler(l)), a(o.Cut, (l) => e.clipboardManager[t(428)](l)), a(o.Copy, (l) => {
      const c = t;
      e.showOpTooltip("复制"), e.clipboardManager[c(422)](l);
    }), a(o[t(451)], (l) => e.clipboardManager.pasteHandler(l)), a(o[t(452)], (l) => {
      const c = t;
      e.showOpTooltip("撤销"), e[c(424)].undo(), e.clearCtrlBoxs();
    }), a(o.Redo, (l) => {
      const c = t;
      e[c(441)]("重做"), e[c(424)].redo(l), e.clearCtrlBoxs();
    }), a(o[t(438)], (l) => {
      const c = t;
      e.showOpTooltip("全选");
      let h = n.camera[c(439)][c(437)](), d = Le.flatten(h[c(453)], (g) => g.visible == 1);
      n.select(d);
    }), a(o.Select_invert, (l) => {
      const c = t;
      e.showOpTooltip("反选");
      let h = n.selectedGroup.getTopObjects();
      n[c(445)](r.displayList.filter((d) => !h.includes(d)));
    }), a(o[t(430)], (l) => {
      const c = t;
      e.showOpTooltip("保存"), e.saveHandler(l, e[c(429)]);
    }, !1), a(o.Open, (l) => {
      e[t(441)]("打开"), e.openLasted(l);
    }, !1), a(o.LocalView, (l) => {
      e.toogleLocalView();
    }), a(o.Copy_style, (l) => {
      const c = t;
      e.showOpTooltip("复制样式"), e.clipboardManager[c(442)](l);
    }, !1), a(o.paste_Style, (l) => {
      e[t(441)]("粘贴样式"), e.clipboardManager.stylePasteHandler(l);
    }, !1), a(o.Move_left, (l) => {
      const c = t;
      n.selectedGroup[c(444)]().filter((h) => h[c(443)]).forEach((h) => {
        h.x -= 1;
      });
    }), a(o.Move_right, (l) => {
      const c = t;
      n.selectedGroup.getTopObjects()[c(432)]((h) => h.isNode)[c(448)]((h) => {
        h.x += 1;
      });
    }), a(o[t(440)], (l) => {
      n.selectedGroup.getTopObjects().filter((c) => c.isNode).forEach((c) => {
        c.y -= 1;
      });
    }), a(o.Move_down, (l) => {
      n.selectedGroup.getTopObjects().filter((c) => c.isNode).forEach((c) => {
        c.y += 1;
      });
    }), a(o.Layout_grid, (l) => {
      const c = t;
      e[c(447)][c(454)]();
    }), a(o.Cancel, (l) => {
      e.onEsc(l);
    });
  }
}
function Zt() {
  const s = ["9OIuQtd", "layoutManager", "pasteHandler", "4241930Qjpmoj", "25389wDHxNn", "顶部对齐", "1910yQPQRK", "右对齐", "align", "inputSystem", "10043760OEeNCJ", "copyHandler", "editorEventManager", "2334CtMcNh", "2971754FPpZls", "changeLevel", "stage", "5340mBMEJR", "evenSpacing", "284898WTYdfi", "3BBANoD", "target", "垂直中心对齐", "16465340gCEXrA"];
  return (Zt = function() {
    return s;
  })();
}
function $t(s, t) {
  const e = Zt();
  return ($t = function(n, r) {
    return e[n -= 364];
  })(s, t);
}
(function() {
  const s = $t, t = Zt();
  for (; ; )
    try {
      if (parseInt(s(364)) / 1 + -parseInt(s(383)) / 2 * (-parseInt(s(365)) / 3) + -parseInt(s(386)) / 4 * (-parseInt(s(375)) / 5) + -parseInt(s(382)) / 6 * (parseInt(s(373)) / 7) + parseInt(s(379)) / 8 + parseInt(s(369)) / 9 * (-parseInt(s(368)) / 10) + parseInt(s(372)) / 11 === 864408)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
function J(s, t) {
  var e = te();
  return (J = function(n, r) {
    return e[n -= 355];
  })(s, t);
}
function te() {
  var s = ["2702MqCkXs", "15633fijJLX", "type", "183BcLFYQ", "6265919KgYmgY", "1553641wMVytf", "2484008ToCIRV", "source", "60oztIyA", "1680QGBIbl", "5121130THlIQn", "23958uskfdw", "15864qeWXVK"];
  return (te = function() {
    return s;
  })();
}
(function() {
  for (var s = J, t = te(); ; )
    try {
      if (-parseInt(s(360)) / 1 + parseInt(s(366)) / 2 * (parseInt(s(358)) / 3) + parseInt(s(361)) / 4 + -parseInt(s(365)) / 5 + -parseInt(s(367)) / 6 * (parseInt(s(355)) / 7) + -parseInt(s(364)) / 8 * (parseInt(s(356)) / 9) + parseInt(s(363)) / 10 * (parseInt(s(359)) / 11) === 806274)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ct {
  constructor() {
    this.take = 0;
  }
  copyPut(t) {
    var e = J;
    this.take = 0, this.type = "copy", this[e(362)] = t;
  }
  cutPut(t) {
    this.take = -1, this.type = "cut", this.source = t;
  }
  takeSource() {
    var t = J;
    return this.take++, this[t(362)];
  }
  isFirstCutPaste() {
    return this[J(357)] == "cut" && this.take == 0;
  }
  clear() {
    var t = J;
    this.type = null, this.take = 0, this[t(362)] = null;
  }
}
const tt = G;
function ee() {
  const s = ["styleCopyHandler", "paste", "connectBox", "inputSystem", "unlinks", "10CvstWT", "copyPut", "jsonToObjects", "recordEnd", "dispatchEvent", "nodeResizeBox", "clipboard", "localView", "addChild", "1132vGLXnt", "map", "record", "forEach", "stage", "198SSyZkv", "cssClipBoard", "7LqQruR", "粘贴样式", "length", "13754kOkpcX", "editor", "parents", "1070091RVwqol", "5890856raUTbs", "11427348GVqZRq", "8764315JcImrB", "16358243nKrWaW", "concat", "serializerSystem", "selectedGroup", "pasteHandler", "3444brzbwf"];
  return (ee = function() {
    return s;
  })();
}
function G(s, t) {
  const e = ee();
  return (G = function(n, r) {
    return e[n -= 273];
  })(s, t);
}
(function() {
  const s = G, t = ee();
  for (; ; )
    try {
      if (parseInt(s(280)) / 1 * (parseInt(s(275)) / 2) + parseInt(s(292)) / 3 * (parseInt(s(307)) / 4) + -parseInt(s(286)) / 5 + parseInt(s(285)) / 6 + parseInt(s(277)) / 7 * (parseInt(s(284)) / 8) + -parseInt(s(283)) / 9 + parseInt(s(298)) / 10 * (-parseInt(s(287)) / 11) === 968570)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ue {
  constructor(t) {
    this[G(276)] = new Ct(), this.clipboard = new Ct(), this.cssClipBoard = new Ct(), this.editor = t;
  }
  reset() {
    const t = G;
    this.clipboard.clear(), this[t(276)].clear();
  }
  copyHandler() {
    const t = G;
    let e = this[t(281)][t(274)], n = [].concat(e.selectedGroup.getTopObjects());
    if (n.length == 0)
      return;
    let r = n.map((o) => o.parent);
    this.clipboard[t(299)]({ type: "objects", parents: r, sourceObjArr: n });
    let i = new B("copy", { target: n });
    this.editor.dispatchEvent(i);
  }
  cutHandler() {
    const t = G;
    let e = this[t(281)], n = e[t(274)], r = [][t(288)](n.selectedGroup.getTopObjects());
    if (r[t(279)] == 0)
      return;
    let i = r[t(308)]((a) => a.parent);
    this[t(304)].cutPut({ type: "objects", parents: i, sourceObjArr: r }), e[t(309)]("剪切"), r.forEach((a, l) => {
      const c = t;
      i[l].removeChild(a), R[c(297)](a, r);
    }), e.recordEnd("剪切"), n.inputSystem._clearTarget(), e[t(295)].clearTarget(), e[t(303)].clearTarget(), e.linkCtrlBox.clearTarget();
    let o = new B("cut", { target: r });
    this.editor[t(302)](o);
  }
  [tt(291)]() {
    const t = tt;
    let e = this.editor, n = e.stage[t(296)], r = this.clipboard.takeSource();
    if (r == null)
      return;
    let i = e[t(274)], o = r.sourceObjArr, a = r[t(282)];
    a = a.map((m) => {
      const x = t;
      let b = i.camera[x(305)].object;
      return b == null || b.contains(m) ? m : i.camera.localView.object;
    });
    let l = o[t(308)]((m) => m._obb.aabb), c = me.unionRects(l).getCenter(), h = n.xInWorld - c.x, d = n.yInWorld - c.y;
    e.record("粘贴");
    let g = o, p = i.serializerSystem.objectsToJSON(o);
    g = i[t(289)][t(300)](p), g[t(273)]((m, x) => {
      m.translateWith(h, d);
    }), g[t(273)]((m, x) => {
      const b = t;
      a[x][b(306)](m);
    }), e.recordEnd("粘贴");
    let u = new B(t(294), { target: g });
    this.editor[t(302)](u);
  }
  [tt(293)]() {
    const t = tt;
    let e = this[t(281)].stage, n = e[t(296)].target;
    n == null && (!e[t(290)].isEmpty() && (n = e.selectedGroup.objects[0]), n == null) || this.cssClipBoard[t(299)]({ type: "style", parents: [n.parent], sourceObjArr: [n] });
  }
  stylePasteHandler() {
    const t = tt;
    let e = this.editor, n = this.cssClipBoard.takeSource();
    if (n == null || n.sourceObjArr.length == 0)
      return;
    let r = e.stage.selectedGroup.objects, i = this;
    e[t(309)](t(278));
    let o = n.sourceObjArr[0];
    r.forEach((a) => {
      i.copySetStyle(a, o);
    }), e[t(301)](t(278));
  }
  copySetStyle(t, e) {
    if (t !== e && t.className == e.className) {
      for (let n = 0; n < e.classList.length; n++)
        t.classList[n] = e.classList[n];
      t.setStyles(e.style);
    }
  }
}
const K = yt;
function ne() {
  const s = ["height", "963VfxodQ", "2591919dIWSPq", "width", "_positionToLocalPoint", "NodeCtrlBox", "4542433akBefL", "4yQllqk", "center", "point", "hide", "editor", "updateSize", "resize", "261288gXACXL", "27920kHEUoj", "atan2", "update", "3657880nHkPsb", "translate", "2958186TIgBpT", "attachTo", "currObject", "5pOTOkh", "247867emmleF"];
  return (ne = function() {
    return s;
  })();
}
function yt(s, t) {
  const e = ne();
  return (yt = function(n, r) {
    return e[n -= 435];
  })(s, t);
}
(function() {
  const s = yt, t = ne();
  for (; ; )
    try {
      if (parseInt(s(447)) / 1 * (parseInt(s(455)) / 2) + parseInt(s(450)) / 3 + parseInt(s(437)) / 4 + -parseInt(s(446)) / 5 * (parseInt(s(443)) / 6) + -parseInt(s(454)) / 7 + parseInt(s(441)) / 8 + parseInt(s(449)) / 9 * (-parseInt(s(438)) / 10) === 441570)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ye extends k {
  constructor(t, e = 0, n = 0, r = 1, i = 1) {
    const o = yt;
    super(null, e, n, r, i), this.zIndex = ut.ZIndex[o(453)], this.editor = t, this.setStyles(y.dropBox.style), this.pointerEnabled = !1, this.currObject, this.hide();
  }
  [K(440)]() {
    this.visible && this.currObject != null && this.updateSize();
  }
  [K(444)](t) {
    const e = K;
    return t == null ? (this.currObject = null, void this[e(458)]()) : t instanceof k && !this[e(459)].isEditable(t) ? (this.currObject = null, void this.hide()) : (this.currObject = t, this.updateSize(), void this.show());
  }
  [K(435)]() {
    const t = K;
    this.currObject != null && this.viewClone(this[t(445)]);
  }
  viewClone(t) {
    const e = K;
    let n = this.editor.stage;
    if (t instanceof Lt)
      return this.resize(n[e(451)] - 10, n.height - 10), this.rotate(0), void this.translate(0.5 * n.width, 0.5 * n[e(448)]);
    if (!(t instanceof v) && t instanceof k) {
      let r = n.camera.getObjectScreenTransform(t), i = r.point(t._positionToLocalPoint(I[e(456)])), o = r.point(t[e(452)](I.rm)), a = Math[e(439)](o.y - i.y, o.x - i.x);
      r.rotate(-a);
      let l = r[e(457)](t[e(452)](I.center)), c = r.point(t._positionToLocalPoint(I.rb)), h = 2 * (c.x - l.x), d = 2 * (c.y - l.y), g = 4;
      this[e(436)](h + 2 * g, d + 2 * g), this.rotate(a), this[e(442)](i.x, i.y);
    }
  }
}
function se() {
  const s = ["getAllNodes", "621168fPNjFT", "parent", "55HskWTp", "2605872EsAmrL", "canSee", "stage", "421778hYzynj", "13528128jkCzUH", "2336454llXOvW", "3705292njVFZR", "1022105JEmiMj", "filter"];
  return (se = function() {
    return s;
  })();
}
function ye(s, t) {
  const e = It;
  let n, r = s.stage.getCurrentLayer(), i = s[e(403)].camera, o = r[e(410)]()[e(409)]((l) => {
    const c = e;
    let h = l;
    return h.visible && h.isSelected != 1 && h.pointerEnabled && i[c(402)](h);
  }), a = t.filter((l) => l.isOutOfParent() || l.parent === r);
  for (let l = 0; l < a.length && (n = Ke(a[l], o), n == null); l++)
    ;
  return n == null && (n = r, a = a.filter((l) => l[e(412)] !== r)), { parent: n, objects: a };
}
function It(s, t) {
  const e = se();
  return (It = function(n, r) {
    return e[n -= 402];
  })(s, t);
}
function Ke(s, t) {
  const e = s.getAABB(), n = t.filter((r) => r !== s[It(412)] && r !== s && !s.contains(r));
  for (let r = n.length - 1; r >= 0; r--) {
    const i = n[r];
    if (i.getAABB().isIntersectRect(e))
      return i;
  }
  return null;
}
(function() {
  const s = It, t = se();
  for (; ; )
    try {
      if (parseInt(s(404)) / 1 + parseInt(s(414)) / 2 + parseInt(s(406)) / 3 + -parseInt(s(407)) / 4 + -parseInt(s(413)) / 5 * (-parseInt(s(411)) / 6) + -parseInt(s(408)) / 7 + -parseInt(s(405)) / 8 === 878986)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const w = re;
function re(s, t) {
  const e = ie();
  return (re = function(n, r) {
    return e[n -= 260];
  })(s, t);
}
function ie() {
  const s = ["pointermoveHandler", "isDragEnd", "Control", "update", "record", "739264lsSdpJ", "setCursor", "round", "7736859oaAsFp", "attachTo", "控制点", "getTopObjects", "length", "12380gErFkr", "handlerLayer", "_pickUp", "pointerupHandler", "pointeroutHandler", "1337427Ilbpab", "auto", "keyboard", "21qcBBZE", "2238zEFAEY", "isEditable", "isKeydown", "isConnectable", "对象拖拽", "clearTarget", "alignManager", "recordName", "mode", "2224728qQpZEs", "pointerenterHandler", "controlTarget", "3378WBDrwt", "pointeroutStageHandler", "addChild", "removeChild", "objects", "dragend", "camera", "hide", "6963198fOsFzo", "stage", "selectedGroup", "inputSystem", "connectBox", "dblclickHandler", "init", "target", "_dragHandler", "delete", "1852vbIabg", "editor", "selectedGroupDragEndHandler", "pointerenterStageHandler", "10iygZuR", "modechange", "pointerdownHandler", "nodeResizeBox", "linkCtrlBox", "crosshair"];
  return (ie = function() {
    return s;
  })();
}
(function() {
  const s = re, t = ie();
  for (; ; )
    try {
      if (-parseInt(s(275)) / 1 + parseInt(s(279)) / 2 * (parseInt(s(291)) / 3) + parseInt(s(309)) / 4 * (parseInt(s(270)) / 5) + -parseInt(s(299)) / 6 + -parseInt(s(278)) / 7 * (parseInt(s(262)) / 8) + parseInt(s(265)) / 9 * (parseInt(s(313)) / 10) + parseInt(s(288)) / 11 === 693097)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Qe = ue.w != null ? ue.w.charAt(3) : "1";
class qe {
  constructor(t) {
    this.editor = t, this.init();
  }
  [w(305)]() {
    const t = w;
    let e = this.editor, n = e[t(300)];
    n.inputSystem;
    let r = e.handlerLayer;
    n.camera.localView[t(287)] == null && (n.addEventListener(t(314), function(i) {
      const o = t;
      let a = i.mode, l = e[o(316)], c = e.linkCtrlBox, h = e.dropToBox, d = e.connectBox;
      a == Ee.edit ? (r[o(293)](l), r[o(293)](c), r.addChild(d), r.addChild(h)) : (r.removeChild(l), r[o(294)](c), r.removeChild(d), r.removeChild(h)), e[o(260)]();
    }), n.selectedGroup.addEventListener(t(296), function(i) {
      const o = t;
      e.selectedGroupDragHandler(i, n[o(301)].getTopObjects());
    }), n.selectedGroup.addEventListener("dragstart", function(i) {
      e.selectedGroupDragEndHandler(i, n.selectedGroup.getTopObjects());
    }));
  }
  deleteHandler() {
    const t = w;
    let e = this[t(310)], n = e.stage.selectedGroup;
    if (Qe != "1")
      return null;
    let r = n.getTopObjects();
    n.removeAll(), e.connectBox.clearTarget(), e[t(316)].clearTarget(), e[t(317)][t(284)](), e.instanceManager[t(308)](r), e.dispatchEvent(new B("delete", { target: r }));
  }
  [w(315)](t) {
    const e = w, n = this.editor;
    if (n.stage.getCurrentLayer() == null)
      return void n._hideAllAttaches();
    const r = n.stage[e(302)];
    let i = n[e(271)], o = n.nodeResizeBox, a = n[e(317)];
    n.alignManager.pointerdownHandler(r);
    let l = i._pickUp();
    if (n.controlTarget = l, n.connectBox.hide(), l != null) {
      let c = l.parent;
      return c !== o ? o[e(298)]() : c !== a && a[e(298)](), l.pointerdownHandler(r), void r.event.preventDefault();
    }
    a.hide(), o[e(298)]();
  }
  mousewheelHandler(t) {
  }
  [w(304)](t) {
  }
  pointupHandler(t) {
    const e = w, n = this.editor, r = n.stage.inputSystem;
    n[e(285)].pointerupHandler(r);
    let i = n.stage, o = n.nodeResizeBox, a = n.linkCtrlBox, l = n.controlTarget;
    if (l != null)
      return r[e(320)] && !(l instanceof lt) && n.recordEnd("控制点"), l[e(273)](r), r.event.preventDefault(), void n.update();
    if (r.button == 2)
      return;
    let c = i.inputSystem[e(306)];
    if (c != null ? (n[e(280)](c) && (c instanceof v ? a.attachTo(c) : c instanceof k && o.attachTo(c)), n.isConnectable(c) && n.connectBox.setTarget(c)) : (n.connectBox.clearTarget(), o.clearTarget(), a[e(284)]()), n.dropToBox.currObject != null) {
      let h = n[e(300)].selectedGroup[e(268)](), d = ye(n, h), g = d.parent;
      d[e(295)].forEach((p) => {
        p.changeParent(g), xe._upgradeLinks(p).length;
      });
    }
    n.dropToBox.attachTo(null);
  }
  _dragHandler(t) {
    const e = w, n = this.editor, r = n[e(300)].inputSystem;
    if (r.buttons == 2)
      return;
    n.keyboard[e(281)]("Shift") && n.stage.setCursor(S[e(318)]);
    let i = n[e(290)];
    if (i != null)
      return r.isDragStart && !(i instanceof lt) && n.record(e(267)), i.dragHandler(r), r.event instanceof MouseEvent && r.event.defaultPrevented == 1 ? void 0 : void r.event.preventDefault();
    n[e(285)][e(307)](r), n.dropToBox.hide();
    const o = n.keyConfig.DropTo_leader;
    if (n.stage.inputSystem.target && n.keyboard[e(281)](o)) {
      let a = n.stage.selectedGroup[e(268)](), l = ye(n, a), c = l.parent;
      l[e(295)], c instanceof k && n.isEditable(c) ? n.dropToBox.attachTo(c) : c instanceof Lt && n.dropToBox[e(266)](c);
    }
  }
  [w(319)](t) {
    const e = w, n = this[e(310)];
    let r = n.stage;
    const i = r.inputSystem, o = r.handlerLayer;
    if (r[e(263)](S[e(276)]), n[e(277)][e(281)](e(321)) && n.connectBox.findConnectableEndpoint([]))
      return;
    let a = o[e(272)]();
    if (a !== n.mouseOverTarget && (n.mouseOverTarget != null && n.mouseOverTarget[e(274)](i), a != null && a.pointerenterHandler(i)), n.mouseOverTarget = a, a != null)
      return void a[e(319)](i);
    let l = r.getCurrentLayer()._pickUp();
    l != null && (n[e(300)].setCursor(S.move), l.isNode && n[e(282)](l) && n.connectBox.setTarget(l));
  }
  [w(289)](t) {
    const e = w, n = this.editor;
    n.linkCtrlBox.pointerenterStageHandler(), n.nodeResizeBox.pointerenterStageHandler(), n[e(303)][e(312)]();
  }
  pointeroutHandler(t) {
    const e = w, n = this.editor;
    n[e(286)] != null && n.recordInterrupt(), n.linkCtrlBox[e(292)](), n[e(316)].pointeroutStageHandler(), n.connectBox.pointeroutStageHandler();
  }
  selectedGroupDragHandler(t, e) {
    const n = w, r = this[n(310)];
    if (r[n(300)].inputSystem.isDragStart && r[n(261)]("对象拖拽"), e[n(269)] == 1) {
      const i = e[0];
      r.stage[n(297)].toScreenRect(i._obb.aabb).getCenter();
    }
  }
  [w(311)](t, e) {
    const n = w, r = this.editor;
    r.stage[n(302)].isPointerOn ? (e.forEach((i) => {
      const o = n;
      i.isNode && (i.x = Math.round(i.x), i.y = Math[o(264)](i.y));
    }), r.recordEnd(n(283))) : r.recordInterrupt();
  }
}
function oe() {
  const s = ["filter", "stage", "pointsLayout", "上移一层", "selectedGroup", "653558zhTHMG", "doLayout", "resize", "24204UrGoGN", "right", "translate", "getTopObjects", "146304LMVXdv", "raiseToTop", "1182490deaplZ", "顶部对齐", "isNode", "isDisplayObjectHost", "evenSpacing", "editor", "下移一层", "1903055qLBabt", "align", "length", "64KaATiS", "190560jQUnEY", "108QRrJgH", "lowerToBottom", "78DTvZQo", "translateWith", "getUnionRect", "216685KQHivu"];
  return (oe = function() {
    return s;
  })();
}
const Q = bt;
function bt(s, t) {
  const e = oe();
  return (bt = function(n, r) {
    return e[n -= 433];
  })(s, t);
}
(function() {
  const s = bt, t = oe();
  for (; ; )
    try {
      if (-parseInt(s(445)) / 1 + -parseInt(s(457)) / 2 + -parseInt(s(446)) / 3 * (parseInt(s(460)) / 4) + parseInt(s(441)) / 5 + parseInt(s(448)) / 6 * (parseInt(s(451)) / 7) + -parseInt(s(444)) / 8 * (-parseInt(s(464)) / 9) + parseInt(s(434)) / 10 === 296148)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Je {
  constructor(t) {
    this.editor = t;
  }
  changeLevel(t, e) {
    const n = bt;
    e == n(455) ? R.raise(t) : e == n(440) ? R.lower(t) : e == "移至顶部" ? R[n(433)](t) : e == "移至底部" && R[n(447)](t);
  }
  [Q(438)](t) {
    const e = Q;
    let n = this[e(439)][e(453)][e(456)].getTopObjects();
    n = n[e(452)]((r) => r.isNode || r instanceof v && Ie(r)), n.length;
  }
  [Q(442)](t) {
    const e = Q, n = this.editor;
    let r = n.stage.selectedGroup[e(463)]();
    if (r = r.filter((a) => a[e(436)] || a instanceof v && Ie(a)), r.length == 0)
      return;
    let i = r.map((a) => a._obb.aabb), o = me.unionRects(i);
    for (let a = 0; a < r[e(443)]; a++) {
      let l = r[a], c = l._obb.aabb;
      t == "左对齐" ? l.translateWith(o.x - c.x, 0) : t == "右对齐" ? l.translateWith(o[e(461)] - c.right, 0) : t == e(435) ? l.translateWith(0, o.y - c.y) : t == "底部对齐" ? l.translateWith(0, o.bottom - c.bottom) : t == "水平中心对齐" ? l.translateWith(0, o.middle - c.middle) : t == "垂直中心对齐" && l[e(449)](o.center - c.center, 0);
    }
    n.update();
  }
  doGridLayout() {
    const t = Q;
    let e = this.editor.stage, n = e.selectedGroup.getTopObjects().filter((c) => c instanceof k);
    if (n[t(443)] < 2)
      return;
    let r = Math.ceil(Math.sqrt(n[t(443)])), i = xe[t(450)](n).getCenter(), o = Pe.grid(r, r), a = e.layoutSystem[t(454)](n, o), l = n[0].width * r;
    a[t(459)](l, l), a[t(462)](i.x, i.y), a[t(458)]({ effect: "easeInQuart", duration: 300 });
  }
}
function Ie(s) {
  const t = Q;
  return !s.begin.isDisplayObjectHost() && !s.end[t(437)]();
}
const et = V;
function ae() {
  const s = ["setEnd", "lineDrawn", "unlinks", "removeFromParent", "7116650dwGyuT", "_addNewInstance", "33649ZEgido", "15760261LTKkQf", "444OhSvAg", "ZIndex", "create", "lineDrawingFinished", "8onXquz", "isLink", "Link", "width", "926764XktamL", "camera", "5337WsrbZU", "1345645DwsUkJ", "3SZIrKY", "513755fnZnPB", "7096fLVUjL", "includes", "editor", "zIndex", "getObject", "height"];
  return (ae = function() {
    return s;
  })();
}
function V(s, t) {
  const e = ae();
  return (V = function(n, r) {
    return e[n -= 242];
  })(s, t);
}
(function() {
  const s = V, t = ae();
  for (; ; )
    try {
      if (parseInt(s(267)) / 1 + parseInt(s(262)) / 2 * (-parseInt(s(266)) / 3) + parseInt(s(258)) / 4 * (parseInt(s(265)) / 5) + parseInt(s(254)) / 6 * (-parseInt(s(252)) / 7) + parseInt(s(268)) / 8 * (-parseInt(s(264)) / 9) + -parseInt(s(250)) / 10 + parseInt(s(253)) / 11 === 428008)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ze {
  constructor(t) {
    this[V(242)] = t;
  }
  delete(t) {
    const e = V;
    let n = this.editor;
    n.record("删除"), t.forEach(function(r) {
      const i = V;
      R[i(248)](r), r[i(249)]();
    });
    {
      let r = n.stage[e(263)].localView, i = r.getObject();
      i && !(i instanceof Lt) && t[e(269)](i) && r.quit();
    }
    n.showOpTooltip("删除"), n.recordEnd("删除");
  }
  _addNewInstance(t) {
    const e = V;
    this[e(242)].stage.camera.localView[e(244)]().addChild(t);
  }
  [et(256)](t) {
    const e = et;
    let n = this.editor.stage[e(263)].localView.getMouseXY(), r = n.x, i = n.y, o = pe.newInstance(t);
    if (o instanceof k)
      return o.x = r, o.y = i, o[e(261)] = 64, o[e(245)] = 64, this._addNewInstance(o), o;
    if (o instanceof v)
      return o.setBegin({ x: r - 40, y: i }), o.setEnd({ x: r + 40, y: i + (t == e(260) ? 0 : 80) }), this[e(251)](o), o;
    throw new Error("unknow classname:" + t);
  }
  [et(247)](t, e, n) {
    const r = et;
    let i = this[r(242)], o = pe.newInstance(i.getLinkClassName());
    o.setBegin(n), o[r(246)](e);
    const a = Object.assign({}, i.newLinkProperties);
    a.css && (o.setStyles(a.css), delete a.css), Object.keys(a).forEach((c) => {
      let h = a[c];
      o[c] = typeof h == "function" ? h() : h;
    });
    let l = t.isNode || t[r(259)] ? t.parent : i.getCurrentLayer();
    return o[r(243)] = ut[r(255)].EditorNewLink, l.addChild(o), i.dispatchEvent(new B("linkbegin", { target: o })), o;
  }
  [et(257)](t) {
    let e = new B("linkend", { target: t });
    this.editor.dispatchEvent(e);
  }
}
const F = Z;
function le() {
  const s = ["right", "isIntersectRect", "top", "62584RezCHs", "aabb", "abs", "dyLine", "selectedGroup", "horizontalTarget", "39755cRWfZU", "verticalType", "188bMsPWR", "align", "564DUNaln", "_obb", "94108JNYqPq", "horizontalType", "_disabled", "max", "alignLineStyle", "left", "target", "hide", "setBegin", "9bAaDks", "camera", "alignInfo", "filter", "pointerEnabled", "round", "visible", "length", "317867VEyLtW", "parent", "show", "2621652fjakfS", "bottom", "342XuJKQe", "_dragHandler", "editor", "stage", "toScreenRect", "5828vqpTlt", "5631110pGbxyZ", "enable", "MAX_VALUE", "pointerdownHandler", "middle", "center", "setStyles"];
  return (le = function() {
    return s;
  })();
}
function Z(s, t) {
  const e = le();
  return (Z = function(n, r) {
    return e[n -= 473];
  })(s, t);
}
(function() {
  const s = Z, t = le();
  for (; ; )
    try {
      if (parseInt(s(504)) / 1 + parseInt(s(514)) / 2 * (parseInt(s(485)) / 3) + parseInt(s(483)) / 4 * (-parseInt(s(481)) / 5) + -parseInt(s(509)) / 6 * (-parseInt(s(487)) / 7) + -parseInt(s(475)) / 8 * (-parseInt(s(496)) / 9) + -parseInt(s(515)) / 10 + -parseInt(s(507)) / 11 === 464690)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class $e {
  constructor(t) {
    this[Z(489)] = !1, this.visible = !1, this.editor = t, this.init(t);
  }
  init(t) {
    const e = Z;
    this.alignInfo = { horizontalType: null, verticalType: null, horizontalTarget: null, verticalTartet: null };
    let n = new v(null, { x: 0, y: 0 }, { x: 100, y: 100 });
    n[e(521)](y.align[e(491)]), n.pointerEnabled = !1, this.dxLine = n;
    let r = new v(null, { x: 0, y: 0 }, { x: 100, y: 100 });
    r[e(521)](y[e(484)].alignLineStyle), r[e(500)] = !1, this.dyLine = r, n.hide(), r[e(494)](), t.handlerLayer.addChild(n), t.handlerLayer.addChild(r);
  }
  disable() {
    const t = Z;
    this._disabled = !0, this.dxLine[t(494)](), this.dyLine[t(494)]();
  }
  [F(516)]() {
    this._disabled = !1;
  }
  getAlignInfo(t, e) {
    const n = F, r = this.editor.stage;
    let i = t.target;
    if (r[n(479)].objects[n(503)] > 1)
      return this.alignInfo.horizontalType = null, this.alignInfo.verticalType = null, this.alignInfo.horizontalTarget = null, this.alignInfo.verticalTartet = null, this[n(498)];
    let o = X.aliagnAble(i, i);
    const a = r.getCurrentLayer().displayList[n(499)](o);
    let l = this.editor.stage[n(497)].scale * e;
    return this.findAlignRectInfo(i._obb.aabb, a, l);
  }
  [F(518)](t) {
    this.dxLine.hide(), this.dyLine.hide();
  }
  pointerupHandler(t) {
    const e = F;
    if (this[e(489)])
      return;
    let n = t.previous, r = this.dxLine[e(502)] || this.dyLine[e(502)];
    if (n.type !== "pointermove" || r == 0)
      return;
    this.dxLine.hide(), this.dyLine.hide();
    let i = t.target;
    if (i == null || !X.isAlignable(this.editor))
      return;
    const o = Math[e(490)](1, y.align.gridSize);
    let a = i._obb.aabb, l = this.alignInfo;
    if (l[e(488)] != null) {
      let c = i.parent.getWorldTransform().invert(), h = l.horizontalTarget[e(486)].aabb[l[e(488)]] - a[l[e(488)]];
      if (h != 0) {
        let d = c.vec([1, 1], [h, 1]);
        i.x += d[0];
      }
    } else
      i.x = Math.round(i.x / o) * o;
    if (l.verticalType != null) {
      let c = i[e(505)].getWorldTransform().invert(), h = l.verticalTartet._obb.aabb[l.verticalType] - a[l.verticalType];
      if (h != 0) {
        let d = c.vec([1, 1], [1, h]);
        i.y += d[1];
      }
    } else
      i.y = Math[e(501)](i.y / o) * o;
  }
  [F(510)](t) {
    const e = F;
    if (this[e(489)])
      return;
    let n = t[e(493)];
    if (n == null || !n.isNode || (this.dxLine.hide(), this.dyLine.hide(), !X.isAlignable(this.editor)))
      return;
    let r = this.dxLine, i = this[e(478)];
    const o = Math[e(490)](0, y[e(484)].minDistance);
    o == 0 ? (this[e(498)].horizontalType = null, this.alignInfo[e(482)] = null, this.alignInfo[e(480)] = null, this.alignInfo.verticalTartet = null) : this.alignInfo = this.getAlignInfo(t, o);
    const a = this.alignInfo, l = Math.max(1, y.align.gridSize);
    let c = n._obb[e(476)], h = { x: Math.round(c[e(520)] / l) * l, y: Math[e(501)](c.middle / l) * l }, d = this.editor.stage.camera.toScreenXY(h.x, h.y);
    if (a.horizontalType != null) {
      let g = this.editor[e(512)].camera.toScreenRect(n[e(486)].aabb), p = this[e(511)].stage.camera.toScreenRect(a[e(480)]._obb.aabb), u = p[a.horizontalType], m = (g.middle + p[e(519)]) / 2, x = Math.abs(g[e(519)] - p.middle);
      r[e(495)]({ x: u, y: m - x / 2 }), r.setEnd({ x: u, y: m + x / 2 }), r[e(506)]();
    } else {
      let g = d.x, p = d.y, u = l;
      r.setBegin({ x: g, y: p - u / 2 }), r.setEnd({ x: g, y: p + u / 2 }), r.show();
    }
    if (a.verticalType != null) {
      let g = this[e(511)].stage.camera[e(513)](n._obb.aabb), p = this.editor.stage.camera.toScreenRect(a.verticalTartet._obb.aabb), u = (g[e(520)] + p[e(520)]) / 2, m = p[a.verticalType], x = Math.abs(g[e(520)] - p.center);
      i[e(495)]({ x: u - x / 2, y: m }), i.setEnd({ x: u + x / 2, y: m }), i.show();
    } else {
      let g = d.x, p = d.y, u = l;
      i.setBegin({ x: g - u / 2, y: p }), i.setEnd({ x: g + u / 2, y: p }), i.show();
    }
  }
  findAlignRectInfo(t, e, n) {
    const r = F;
    e.map((g) => g._obb.aabb);
    let i, o, a, l, c = Number[r(517)], h = Number.MAX_VALUE;
    e.sort((g, p) => {
      const u = r;
      return rt.distance(t.center, t[u(519)], p._obb.aabb[u(520)], p._obb[u(476)].middle) - rt.distance(t[u(520)], t.middle, g[u(486)].aabb.center, g._obb.aabb[u(519)]);
    });
    let d = 0;
    for (let g = 0; g < e[r(503)]; g++) {
      let p = e[g], u = p[r(486)].aabb;
      u[r(473)](t) || (d = Math.abs(t.top - u[r(474)]), d <= h && d <= n && (l = "top", o = p, h = d), d = Math.abs(t.bottom - u[r(508)]), d <= h && d <= n && (l = "bottom", o = p, h = d), d = Math[r(477)](t.middle - u[r(519)]), d <= h && d <= n && (l = "middle", o = p, h = d), d = Math[r(477)](t.left - u[r(492)]), d <= c && d < n && (a = r(492), i = p, c = d), d = Math.abs(t.right - u.right), d <= c && d < n && (a = r(522), i = p, c = d), d = Math[r(477)](t.center - u.center), d <= c && d < n && (a = "center", i = p, c = d));
    }
    return { horizontalType: a, verticalType: l, horizontalTarget: i, verticalTartet: o };
  }
}
function mt(s, t) {
  const e = ce();
  return (mt = function(n, r) {
    return e[n -= 256];
  })(s, t);
}
const nt = mt;
function ce() {
  const s = ["2327418CRPKvP", "guildlineV", "height", "stage", "8255680gcqMqJ", "width", "inputSystem", "disable", "show", "59608656fsLzOe", "4622cFpXGm", "guildlineH", "3509540jftCoT", "init", "21NyrtNi", "hideGuidLine", "1443oWHlpA", "styleH", "setEnd", "11757288Ofrote", "1161424flcIDj", "name"];
  return (ce = function() {
    return s;
  })();
}
(function() {
  const s = mt, t = ce();
  for (; ; )
    try {
      if (-parseInt(s(274)) / 1 + -parseInt(s(264)) / 2 * (parseInt(s(270)) / 3) + parseInt(s(266)) / 4 + -parseInt(s(258)) / 5 + -parseInt(s(276)) / 6 * (parseInt(s(268)) / 7) + -parseInt(s(273)) / 8 + parseInt(s(263)) / 9 === 943048)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class tn {
  constructor(t) {
    this._disabled = !0, this.editor = t;
  }
  init() {
    const t = mt, e = this.editor.handlerLayer, n = new v();
    n[t(275)] = "guidLineW", n.pointerEnabled = !1, n.setStyles(y.crossGuildLine[t(271)]), n.hide(), this[t(265)] = n, e.addChild(this.guildlineH);
    const r = new v();
    r.name = "guidLineS", r.pointerEnabled = !1, r.setStyles(y.crossGuildLine.styleV), r.hide(), this.guildlineV = r, e.addChild(this.guildlineV);
  }
  [nt(261)]() {
    this._disabled = !0, this.hideGuidLine();
  }
  enable() {
    const t = nt;
    this._disabled = !1, this[t(265)] == null && this[t(267)]();
  }
  updateGuildLine() {
    const t = nt;
    if (this._disabled)
      return;
    const e = this.editor[t(257)], n = this.guildlineH, r = this.guildlineV, i = e[t(260)], o = i.x, a = i.y;
    n.setBegin({ x: 0, y: a }), n.setEnd({ x: e[t(259)], y: a }), n.show(), r.setBegin({ x: o, y: 0 }), r[t(272)]({ x: o, y: e[t(256)] }), r[t(262)]();
  }
  [nt(269)]() {
    const t = nt;
    this.guildlineH.hide(), this[t(277)].hide();
  }
}
const f = xt;
function xt(s, t) {
  const e = he();
  return (xt = function(n, r) {
    return e[n -= 458];
  })(s, t);
}
function he() {
  const s = ["pointermoveHandler", "keyConfig", "selectedGroupDragEndHandler", "clipboardManager", "keyboard", "visible", "update", "pointerenterHandler", "data", "getLinkClassName", "toJSON", "打开json", "onEsc", "length", "dblclickHandler", "disableEdit", "stage", "4412824oJsbuK", "log", "AutoFoldLink", "getCurrentLayer", "linkCtrlBox", "_clearTarget", "controlTarget", "set", "dispatchEvent", "push", "recordEnd", "_disableConnectMap", "reset", "clearTarget", "mousewheelHandler", "isDragEnd", "312750rlEdrk", "253652MCycHr", "camera", "localLastDocName", "_dragHandler", "setHtml", "style", "newLinkProperties", "popupMenu", "pointeroutHandler", "57QqHqaU", "mouseOverTarget", "1371300UZdOvU", "inputTextfield", "object", "connectBox", "editorEventManager", "DataCenter", "defaultPrevented", "inputSystem", "dropToBox", "setConnectable", "disableConnect", "save", "removeEventListener", "existObjectMap", "cancel", "get", "pointerEnabled", "showAt", "recordName", "18571815HEYAWE", "nodeResizeBox", "KeysConfig", "48BEngDp", "instanceManager", "194408XPoNpu", "endArrow", "toogleLocalView", "getBoundingClientRect", "pointupHandler", "label", "redoUndoSys", "localView", "135568BDIJaA", "width", "isEditable", "addEventListener", "dropHandler", "assign"];
  return (he = function() {
    return s;
  })();
}
(function() {
  const s = xt, t = he();
  for (; ; )
    try {
      if (parseInt(s(469)) / 1 + -parseInt(s(504)) / 2 + parseInt(s(478)) / 3 * (-parseInt(s(512)) / 4) + -parseInt(s(468)) / 5 * (parseInt(s(502)) / 6) + -parseInt(s(480)) / 7 + -parseInt(s(535)) / 8 + parseInt(s(499)) / 9 === 328132)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class en extends be {
  constructor(t) {
    const e = xt;
    super(), this.existObjectMap = /* @__PURE__ */ new WeakMap(), this.keyConfig = dt, this.config = y, this.LinkClassName = e(537), this[e(475)] = {}, this.DataCenter = Ve, this.imageToBase64 = !1, this._disableEditMap = /* @__PURE__ */ new Map(), this._disableConnectMap = /* @__PURE__ */ new Map(), this[e(534)] = t, t.editor = this, this.handlerLayer = t.handlerLayer, this[e(522)] = t[e(522)], this[e(521)] = new Ue(this), this.instanceManager = new Ze(this), this.editorEventManager = new qe(this), this.keyManager = new Xe(this), this.nodeResizeBox = new Oe(this), this.linkCtrlBox = new Ne(this), this.connectBox = new Re(this), this.dropToBox = new Ye(this), this.popupMenu = function(n) {
      const r = $t, i = n[r(385)];
      let o = new He(i, `
<div class="header">编辑</div>
<a>剪切</a>
<a>复制</a>
<a>粘贴</a>
<a>删除</a> 
<hr></hr>
<div class="header">前后</div>
<a>上移一层</a>
<a>下移一层</a>
<a>移至顶部</a>
<a>移至底部</a>
<div class="header">对齐</div>
<a>左对齐</a>
<a>右对齐</a>
<a>顶部对齐</a>
<a>底部对齐</a>
<a>水平中心对齐</a>
<a>垂直中心对齐</a>
`);
      return o.addEventListener("select", function(a) {
        const l = r, c = a.item;
        let h = i[l(378)][l(366)];
        c == "剪切" ? n.clipboardManager.cutHandler() : c == "复制" ? n.clipboardManager[l(380)]() : c == "粘贴" ? n.clipboardManager[l(371)]() : c == "删除" && n[l(381)].deleteHandler(), h != null && (c == "上移一层" ? n.layoutManager[l(384)](h, c) : c == "下移一层" ? n[l(370)][l(384)](h, c) : c == "移至顶部" ? n.layoutManager.changeLevel(h, c) : c == "移至底部" ? n.layoutManager[l(384)](h, c) : c == "左对齐" ? n.layoutManager[l(377)]("左对齐") : c == "右对齐" ? n.layoutManager[l(377)](l(376)) : c == "顶部对齐" ? n.layoutManager.align(l(374)) : c == "底部对齐" ? n.layoutManager[l(377)]("底部对齐") : c == "水平中心对齐" ? n.layoutManager.align("水平中心对齐") : c == l(367) ? n[l(370)].align(l(367)) : c == "左右等距" ? n[l(370)][l(387)]("左右等距") : c == "上下等距" && n.layoutManager.evenSpacing("上下等距"), n.update());
      }), o;
    }(this), this.stage[e(487)][e(540)](), this[e(458)] = null, this[e(479)] = null, this.inputTextfield = new Ae(t), this.redoUndoSys = new Ge(this), this.layoutManager = new Je(this), this.alignManager = new $e(this), this.opTooltip = new Me(t), Object.assign(this.opTooltip.domElement[e(474)], { paddingLeft: "20px", paddingRight: "20px", color: "black" }), this.pointerCrossLineManager = new tn(this);
  }
  setLinkClassName(t) {
    this.LinkClassName = t;
  }
  [f(527)]() {
    return this.LinkClassName;
  }
  getCurrentLayer() {
    const t = f;
    return this[t(534)][t(538)]();
  }
  defineKeys(t) {
    const e = f;
    Object[e(517)](this[e(519)], t);
  }
  showOpTooltip(t) {
    const e = f;
    y.operationTip.enable && (this.opTooltip[e(473)](t), this.opTooltip.showAt(0.5 * this[e(534)][e(513)], 0.5 * this.stage.height), this.opTooltip.fadeOut());
  }
  saveHandler(t, e = !1) {
    const n = f;
    let r = this;
    if (e == 1)
      return void this[n(534)].toJSONWithBase64().then((a) => {
        const l = n;
        let c = JSON.stringify(a);
        this.DataCenter.setItem(y[l(526)][l(471)], c), r.dispatchEvent(new B("save", { details: { imageToBase64: e, json: c } }));
      });
    let i = this.stage[n(528)](), o = JSON.stringify(i);
    this[n(485)].setItem(y.data.localLastDocName, o), r.dispatchEvent(new B(n(491), { details: { imageToBase64: e, json: o } }));
  }
  openLasted() {
    const t = f;
    let e = this.DataCenter.getItem(y.data[t(471)]);
    if (e != null) {
      let n = JSON.parse(e);
      console[t(536)](t(529), n), this.stage.fromJSON(n);
    }
    return null;
  }
  [f(515)](t, e) {
    return super.addEventListener(t, e);
  }
  [f(492)](t, e) {
    return super[f(492)](t, e);
  }
  hasListener(t) {
    return super.hasListener(t);
  }
  _checkState() {
    const t = f;
    let e = this.stage[t(538)]();
    return !(e == null || !e[t(496)]) || (this._hideAllAttaches(), !1);
  }
  dblclickHandler(t) {
    const e = f;
    this.editorEventManager[e(532)](t), this.update();
  }
  wheelHandler(t) {
    const e = f;
    this.editorEventManager[e(466)](t), this.update();
  }
  pointerdownHandler(t) {
    const e = f;
    this._checkState() && (this.editorEventManager.pointerdownHandler(t), this.update(), this.stage[e(487)].event[e(486)] || this.popupMenu.hide());
  }
  pointerupHandler(t) {
    const e = f;
    if (!this._checkState())
      return;
    this[e(484)][e(508)](t), this.update();
    let n = this.stage.inputSystem;
    n.button == 2 ? !n[e(467)] && this[e(476)][e(497)](n.x, n.y) : this[e(476)].hide();
  }
  _dragHandler(t) {
    const e = f;
    this.editorEventManager[e(472)](t), this.update(), this.pointerCrossLineManager.updateGuildLine();
  }
  pointermoveHandler(t) {
    const e = f;
    if (this._checkState())
      return this.stage[e(487)].isDraging ? this._dragHandler(t) : (this.editorEventManager[e(518)](t), this[e(458)] && this.stage.handlerLayer[e(524)](), void this.pointerCrossLineManager.updateGuildLine());
  }
  [f(525)](t) {
    this.editorEventManager.pointerenterHandler(t), this.update();
  }
  pointeroutHandler(t) {
    const e = f;
    this[e(484)][e(477)](t), this.update();
  }
  [f(516)](t) {
    this.stage.inputSystem.event.defaultPrevented || this.dispatchEvent(t);
  }
  dragoverHandler(t) {
    const e = f;
    t.preventDefault(), this[e(460)](t);
  }
  selectedGroupDragHandler(t, e) {
    this.editorEventManager.selectedGroupDragHandler(t, e);
  }
  selectedGroupDragEndHandler(t, e) {
    const n = f;
    this[n(484)][n(520)](t, e);
  }
  recordInterrupt() {
    this[f(498)] != null && this.recordEnd(this.recordName), this.recordName = null, this.lastLayerState = null;
  }
  record(t) {
    const e = f;
    let n = this.getCurrentLayer();
    if (n == null)
      return;
    let r = n.stage.serializerSystem;
    this.recordName, this.recordName = t, this.lastLayerState = r._getState(n, this[e(493)]);
  }
  [f(462)](t) {
    const e = f;
    this[e(498)], this.recordName = null;
    const n = this[e(493)];
    let r = this.getCurrentLayer();
    if (r == null)
      return;
    let i = r.stage.serializerSystem, o = this.lastLayerState, a = i._getState(r, n);
    this.redoUndoSys.push(t, function() {
      i._restoreFromState(a, n);
    }, function() {
      i._restoreFromState(o, n);
    });
  }
  update() {
    const t = f;
    this[t(488)].update(), this[t(500)].update(), this.linkCtrlBox.update(), this.connectBox[t(524)]();
  }
  _hideAllAttaches() {
    const t = f;
    this[t(488)].hide(), this.nodeResizeBox.hide(), this[t(539)].hide(), this.connectBox.hide(), this.nodeResizeBox[t(465)](), this[t(539)].clearTarget(), this[t(483)][t(465)]();
  }
  openJson(t) {
    return this[f(534)].fromJSON(t).then(() => {
      this.dispatchEvent(new B("open", { details: { json: t } }));
    });
  }
  showTip(t, e = "") {
    let n = new Event("log");
    n.msg = t + e, this.dispatchEvent(n);
  }
  create(t) {
    return this[f(503)].create(t);
  }
  mockDrop(t) {
    const e = f, n = t.changedTouches[0], r = this.stage.handlerLayer.render.canvas[e(507)](), i = n.clientX - r.left, o = n.clientY - r.top;
    this.stage[e(487)].x = i, this[e(534)][e(487)].y = o, this[e(460)](new PointerEvent("drop"));
  }
  clearCtrlBoxs() {
    const t = f;
    this.connectBox.clearTarget(), this[t(500)].clearTarget(), this.linkCtrlBox.clearTarget();
  }
  [f(506)]() {
    const t = f;
    let e = this[t(534)].inputSystem.target;
    e === this.stage[t(470)].localView[t(482)] ? this[t(534)].camera[t(511)].quit() : this.stage[t(470)].localView.enter(e);
  }
  sendKey(t, e) {
    this.keyboard.sendKey(t, e);
  }
  [f(530)]() {
    const t = f;
    this.connectBox[t(494)]();
  }
  setEditable(t, e) {
    e ? this._disableEditMap.delete(t) : this._disableEditMap.set(t, !0);
  }
  setConnectable(t, e) {
    const n = f;
    e ? this[n(463)].delete(t) : this._disableConnectMap[n(459)](t, !0);
  }
  [f(514)](t) {
    const e = f;
    return t != null && this._disableEditMap.get(t) == null && !!X.isUpdateMatrixed(t) && (!(t.parent instanceof v) || t !== t.parent[e(509)] && t !== t.parent.beginArrow && t !== t.parent.endArrow);
  }
  isConnectable(t) {
    const e = f;
    if (t == null || !t[e(523)] || !t.pointerEnabled)
      return !1;
    let n = t.parent;
    return (!(n instanceof v) || t !== n.label && n.beginArrow !== t && n[e(505)] !== t) && this[e(463)].get(t) == null;
  }
  getEditInfo(t, e) {
    const n = f;
    let r = { disableEdit: [], disableConnect: [] };
    for (let i = 0; i < t.length; i++) {
      let o = t[i], a = e[n(495)](o);
      !this.isEditable(o) && a != null && r.disableEdit.push(a), !this.isConnectable(o) && a != null && r[n(490)][n(461)](a);
    }
    return r.disableEdit.length == 0 && delete r.disableEdit, r.disableConnect[n(531)] == 0 && delete r.disableConnect, r[n(533)] || r[n(490)] ? r : null;
  }
  fromEditInfo(t, e) {
    const n = f;
    if (t.disableEdit != null)
      for (let r = 0; r < t[n(533)][n(531)]; r++) {
        let i = e[t.disableEdit[r]];
        this.setEditable(i, !1);
      }
    if (t.disableConnect != null)
      for (let r = 0; r < t.disableConnect.length; r++) {
        let i = e[t[n(490)][r]];
        this[n(489)](i, !1);
      }
  }
  reset() {
    const t = f;
    this._hideAllAttaches(), this[t(510)].clear(), this[t(521)][t(464)](), this.pickedObject = null, this.mouseOverTarget = null, this.controlTarget = null, this[t(481)].hide();
  }
}
function de() {
  var s = ["309054xQgwxO", "2795628emEIhT", "1119377WajwSQ", "4204056EuRQTA", "1009568UdPcfz", "1UgxyGn", "1455600abcoFI", "390312pcKkJN"];
  return (de = function() {
    return s;
  })();
}
function Ce(s, t) {
  var e = de();
  return (Ce = function(n, r) {
    return e[n -= 362];
  })(s, t);
}
en[f(501)] = dt, function() {
  for (var s = Ce, t = de(); ; )
    try {
      if (-parseInt(s(363)) / 1 * (-parseInt(s(362)) / 2) + -parseInt(s(366)) / 3 + parseInt(s(365)) / 4 + -parseInt(s(364)) / 5 + parseInt(s(367)) / 6 + parseInt(s(368)) / 7 + -parseInt(s(369)) / 8 === 308566)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
}();
export {
  en as Editor,
  rn as IconsPanel,
  on as PropertiesPanel
};
